Commit b92c914d02ad7a77513076515ffe9f26db1fe8af

Authored by Greg Kroah-Hartman
1 parent 345a52558e

Drivers: zorro: remove CONFIG_HOTPLUG usage

CONFIG_HOTPLUG is going away as an option, so remove it from the
zorro-driver.c file.

Cc: Bill Pemberton <wfp5p@virginia.edu>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Showing 1 changed file with 0 additions and 4 deletions Inline Diff

drivers/zorro/zorro-driver.c
1 /* 1 /*
2 * Zorro Driver Services 2 * Zorro Driver Services
3 * 3 *
4 * Copyright (C) 2003 Geert Uytterhoeven 4 * Copyright (C) 2003 Geert Uytterhoeven
5 * 5 *
6 * Loosely based on drivers/pci/pci-driver.c 6 * Loosely based on drivers/pci/pci-driver.c
7 * 7 *
8 * This file is subject to the terms and conditions of the GNU General Public 8 * This file is subject to the terms and conditions of the GNU General Public
9 * License. See the file COPYING in the main directory of this archive 9 * License. See the file COPYING in the main directory of this archive
10 * for more details. 10 * for more details.
11 */ 11 */
12 12
13 #include <linux/init.h> 13 #include <linux/init.h>
14 #include <linux/module.h> 14 #include <linux/module.h>
15 #include <linux/zorro.h> 15 #include <linux/zorro.h>
16 16
17 17
18 /** 18 /**
19 * zorro_match_device - Tell if a Zorro device structure has a matching 19 * zorro_match_device - Tell if a Zorro device structure has a matching
20 * Zorro device id structure 20 * Zorro device id structure
21 * @ids: array of Zorro device id structures to search in 21 * @ids: array of Zorro device id structures to search in
22 * @dev: the Zorro device structure to match against 22 * @dev: the Zorro device structure to match against
23 * 23 *
24 * Used by a driver to check whether a Zorro device present in the 24 * Used by a driver to check whether a Zorro device present in the
25 * system is in its list of supported devices. Returns the matching 25 * system is in its list of supported devices. Returns the matching
26 * zorro_device_id structure or %NULL if there is no match. 26 * zorro_device_id structure or %NULL if there is no match.
27 */ 27 */
28 28
29 const struct zorro_device_id * 29 const struct zorro_device_id *
30 zorro_match_device(const struct zorro_device_id *ids, 30 zorro_match_device(const struct zorro_device_id *ids,
31 const struct zorro_dev *z) 31 const struct zorro_dev *z)
32 { 32 {
33 while (ids->id) { 33 while (ids->id) {
34 if (ids->id == ZORRO_WILDCARD || ids->id == z->id) 34 if (ids->id == ZORRO_WILDCARD || ids->id == z->id)
35 return ids; 35 return ids;
36 ids++; 36 ids++;
37 } 37 }
38 return NULL; 38 return NULL;
39 } 39 }
40 EXPORT_SYMBOL(zorro_match_device); 40 EXPORT_SYMBOL(zorro_match_device);
41 41
42 42
43 static int zorro_device_probe(struct device *dev) 43 static int zorro_device_probe(struct device *dev)
44 { 44 {
45 int error = 0; 45 int error = 0;
46 struct zorro_driver *drv = to_zorro_driver(dev->driver); 46 struct zorro_driver *drv = to_zorro_driver(dev->driver);
47 struct zorro_dev *z = to_zorro_dev(dev); 47 struct zorro_dev *z = to_zorro_dev(dev);
48 48
49 if (!z->driver && drv->probe) { 49 if (!z->driver && drv->probe) {
50 const struct zorro_device_id *id; 50 const struct zorro_device_id *id;
51 51
52 id = zorro_match_device(drv->id_table, z); 52 id = zorro_match_device(drv->id_table, z);
53 if (id) 53 if (id)
54 error = drv->probe(z, id); 54 error = drv->probe(z, id);
55 if (error >= 0) { 55 if (error >= 0) {
56 z->driver = drv; 56 z->driver = drv;
57 error = 0; 57 error = 0;
58 } 58 }
59 } 59 }
60 return error; 60 return error;
61 } 61 }
62 62
63 63
64 static int zorro_device_remove(struct device *dev) 64 static int zorro_device_remove(struct device *dev)
65 { 65 {
66 struct zorro_dev *z = to_zorro_dev(dev); 66 struct zorro_dev *z = to_zorro_dev(dev);
67 struct zorro_driver *drv = to_zorro_driver(dev->driver); 67 struct zorro_driver *drv = to_zorro_driver(dev->driver);
68 68
69 if (drv) { 69 if (drv) {
70 if (drv->remove) 70 if (drv->remove)
71 drv->remove(z); 71 drv->remove(z);
72 z->driver = NULL; 72 z->driver = NULL;
73 } 73 }
74 return 0; 74 return 0;
75 } 75 }
76 76
77 77
78 /** 78 /**
79 * zorro_register_driver - register a new Zorro driver 79 * zorro_register_driver - register a new Zorro driver
80 * @drv: the driver structure to register 80 * @drv: the driver structure to register
81 * 81 *
82 * Adds the driver structure to the list of registered drivers 82 * Adds the driver structure to the list of registered drivers
83 * Returns zero or a negative error value. 83 * Returns zero or a negative error value.
84 */ 84 */
85 85
86 int zorro_register_driver(struct zorro_driver *drv) 86 int zorro_register_driver(struct zorro_driver *drv)
87 { 87 {
88 /* initialize common driver fields */ 88 /* initialize common driver fields */
89 drv->driver.name = drv->name; 89 drv->driver.name = drv->name;
90 drv->driver.bus = &zorro_bus_type; 90 drv->driver.bus = &zorro_bus_type;
91 91
92 /* register with core */ 92 /* register with core */
93 return driver_register(&drv->driver); 93 return driver_register(&drv->driver);
94 } 94 }
95 EXPORT_SYMBOL(zorro_register_driver); 95 EXPORT_SYMBOL(zorro_register_driver);
96 96
97 97
98 /** 98 /**
99 * zorro_unregister_driver - unregister a zorro driver 99 * zorro_unregister_driver - unregister a zorro driver
100 * @drv: the driver structure to unregister 100 * @drv: the driver structure to unregister
101 * 101 *
102 * Deletes the driver structure from the list of registered Zorro drivers, 102 * Deletes the driver structure from the list of registered Zorro drivers,
103 * gives it a chance to clean up by calling its remove() function for 103 * gives it a chance to clean up by calling its remove() function for
104 * each device it was responsible for, and marks those devices as 104 * each device it was responsible for, and marks those devices as
105 * driverless. 105 * driverless.
106 */ 106 */
107 107
108 void zorro_unregister_driver(struct zorro_driver *drv) 108 void zorro_unregister_driver(struct zorro_driver *drv)
109 { 109 {
110 driver_unregister(&drv->driver); 110 driver_unregister(&drv->driver);
111 } 111 }
112 EXPORT_SYMBOL(zorro_unregister_driver); 112 EXPORT_SYMBOL(zorro_unregister_driver);
113 113
114 114
115 /** 115 /**
116 * zorro_bus_match - Tell if a Zorro device structure has a matching Zorro 116 * zorro_bus_match - Tell if a Zorro device structure has a matching Zorro
117 * device id structure 117 * device id structure
118 * @ids: array of Zorro device id structures to search in 118 * @ids: array of Zorro device id structures to search in
119 * @dev: the Zorro device structure to match against 119 * @dev: the Zorro device structure to match against
120 * 120 *
121 * Used by a driver to check whether a Zorro device present in the 121 * Used by a driver to check whether a Zorro device present in the
122 * system is in its list of supported devices.Returns the matching 122 * system is in its list of supported devices.Returns the matching
123 * zorro_device_id structure or %NULL if there is no match. 123 * zorro_device_id structure or %NULL if there is no match.
124 */ 124 */
125 125
126 static int zorro_bus_match(struct device *dev, struct device_driver *drv) 126 static int zorro_bus_match(struct device *dev, struct device_driver *drv)
127 { 127 {
128 struct zorro_dev *z = to_zorro_dev(dev); 128 struct zorro_dev *z = to_zorro_dev(dev);
129 struct zorro_driver *zorro_drv = to_zorro_driver(drv); 129 struct zorro_driver *zorro_drv = to_zorro_driver(drv);
130 const struct zorro_device_id *ids = zorro_drv->id_table; 130 const struct zorro_device_id *ids = zorro_drv->id_table;
131 131
132 if (!ids) 132 if (!ids)
133 return 0; 133 return 0;
134 134
135 while (ids->id) { 135 while (ids->id) {
136 if (ids->id == ZORRO_WILDCARD || ids->id == z->id) 136 if (ids->id == ZORRO_WILDCARD || ids->id == z->id)
137 return 1; 137 return 1;
138 ids++; 138 ids++;
139 } 139 }
140 return 0; 140 return 0;
141 } 141 }
142 142
143 static int zorro_uevent(struct device *dev, struct kobj_uevent_env *env) 143 static int zorro_uevent(struct device *dev, struct kobj_uevent_env *env)
144 { 144 {
145 #ifdef CONFIG_HOTPLUG
146 struct zorro_dev *z; 145 struct zorro_dev *z;
147 146
148 if (!dev) 147 if (!dev)
149 return -ENODEV; 148 return -ENODEV;
150 149
151 z = to_zorro_dev(dev); 150 z = to_zorro_dev(dev);
152 if (!z) 151 if (!z)
153 return -ENODEV; 152 return -ENODEV;
154 153
155 if (add_uevent_var(env, "ZORRO_ID=%08X", z->id) || 154 if (add_uevent_var(env, "ZORRO_ID=%08X", z->id) ||
156 add_uevent_var(env, "ZORRO_SLOT_NAME=%s", dev_name(dev)) || 155 add_uevent_var(env, "ZORRO_SLOT_NAME=%s", dev_name(dev)) ||
157 add_uevent_var(env, "ZORRO_SLOT_ADDR=%04X", z->slotaddr) || 156 add_uevent_var(env, "ZORRO_SLOT_ADDR=%04X", z->slotaddr) ||
158 add_uevent_var(env, "MODALIAS=" ZORRO_DEVICE_MODALIAS_FMT, z->id)) 157 add_uevent_var(env, "MODALIAS=" ZORRO_DEVICE_MODALIAS_FMT, z->id))
159 return -ENOMEM; 158 return -ENOMEM;
160 159
161 return 0; 160 return 0;
162 #else /* !CONFIG_HOTPLUG */
163 return -ENODEV;
164 #endif /* !CONFIG_HOTPLUG */
165 } 161 }
166 162
167 struct bus_type zorro_bus_type = { 163 struct bus_type zorro_bus_type = {
168 .name = "zorro", 164 .name = "zorro",
169 .match = zorro_bus_match, 165 .match = zorro_bus_match,
170 .uevent = zorro_uevent, 166 .uevent = zorro_uevent,
171 .probe = zorro_device_probe, 167 .probe = zorro_device_probe,
172 .remove = zorro_device_remove, 168 .remove = zorro_device_remove,
173 }; 169 };
174 EXPORT_SYMBOL(zorro_bus_type); 170 EXPORT_SYMBOL(zorro_bus_type);
175 171
176 172
177 static int __init zorro_driver_init(void) 173 static int __init zorro_driver_init(void)
178 { 174 {
179 return bus_register(&zorro_bus_type); 175 return bus_register(&zorro_bus_type);
180 } 176 }
181 177
182 postcore_initcall(zorro_driver_init); 178 postcore_initcall(zorro_driver_init);
183 179
184 180