diff options
author | Jeff Garzik <jgarzik@pobox.com> | 2005-08-11 02:47:54 -0400 |
---|---|---|
committer | Jeff Garzik <jgarzik@pobox.com> | 2005-08-11 02:47:54 -0400 |
commit | 2bf69b5fe90b3246ab50064c5a690a363e8c53e2 (patch) | |
tree | fcae64d1ea5670ca8cb33d5711e181708927e883 /drivers/net/phy/phy_device.c | |
parent | 67c4f3fa25502ce7ed82fb0307e09cf36f1f81da (diff) |
phy subsystem: more cleanups
- unexport symbols never used outside of home module
- remove dead code
- remove CONFIG_PHYCONTROL, make it unconditionally enabled
Diffstat (limited to 'drivers/net/phy/phy_device.c')
-rw-r--r-- | drivers/net/phy/phy_device.c | 130 |
1 files changed, 1 insertions, 129 deletions
diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c index c11138330fed..c44d54f6310a 100644 --- a/drivers/net/phy/phy_device.c +++ b/drivers/net/phy/phy_device.c | |||
@@ -124,133 +124,6 @@ void phy_prepare_link(struct phy_device *phydev, | |||
124 | phydev->adjust_link = handler; | 124 | phydev->adjust_link = handler; |
125 | } | 125 | } |
126 | 126 | ||
127 | #ifdef CONFIG_PHYCONTROL | ||
128 | /* phy_connect: | ||
129 | * | ||
130 | * description: Convenience function for connecting ethernet | ||
131 | * devices to PHY devices. The default behavior is for | ||
132 | * the PHY infrastructure to handle everything, and only notify | ||
133 | * the connected driver when the link status changes. If you | ||
134 | * don't want, or can't use the provided functionality, you may | ||
135 | * choose to call only the subset of functions which provide | ||
136 | * the desired functionality. | ||
137 | */ | ||
138 | struct phy_device * phy_connect(struct net_device *dev, const char *phy_id, | ||
139 | void (*handler)(struct net_device *), u32 flags) | ||
140 | { | ||
141 | struct phy_device *phydev; | ||
142 | |||
143 | phydev = phy_attach(dev, phy_id, flags); | ||
144 | |||
145 | if (IS_ERR(phydev)) | ||
146 | return phydev; | ||
147 | |||
148 | phy_prepare_link(phydev, handler); | ||
149 | |||
150 | phy_start_machine(phydev, NULL); | ||
151 | |||
152 | if (phydev->irq > 0) | ||
153 | phy_start_interrupts(phydev); | ||
154 | |||
155 | return phydev; | ||
156 | } | ||
157 | EXPORT_SYMBOL(phy_connect); | ||
158 | |||
159 | void phy_disconnect(struct phy_device *phydev) | ||
160 | { | ||
161 | if (phydev->irq > 0) | ||
162 | phy_stop_interrupts(phydev); | ||
163 | |||
164 | phy_stop_machine(phydev); | ||
165 | |||
166 | phydev->adjust_link = NULL; | ||
167 | |||
168 | phy_detach(phydev); | ||
169 | } | ||
170 | EXPORT_SYMBOL(phy_disconnect); | ||
171 | |||
172 | #endif /* CONFIG_PHYCONTROL */ | ||
173 | |||
174 | /* phy_attach: | ||
175 | * | ||
176 | * description: Called by drivers to attach to a particular PHY | ||
177 | * device. The phy_device is found, and properly hooked up | ||
178 | * to the phy_driver. If no driver is attached, then the | ||
179 | * genphy_driver is used. The phy_device is given a ptr to | ||
180 | * the attaching device, and given a callback for link status | ||
181 | * change. The phy_device is returned to the attaching | ||
182 | * driver. | ||
183 | */ | ||
184 | static int phy_compare_id(struct device *dev, void *data) | ||
185 | { | ||
186 | return strcmp((char *)data, dev->bus_id) ? 0 : 1; | ||
187 | } | ||
188 | |||
189 | struct phy_device *phy_attach(struct net_device *dev, | ||
190 | const char *phy_id, u32 flags) | ||
191 | { | ||
192 | struct bus_type *bus = &mdio_bus_type; | ||
193 | struct phy_device *phydev; | ||
194 | struct device *d; | ||
195 | |||
196 | /* Search the list of PHY devices on the mdio bus for the | ||
197 | * PHY with the requested name */ | ||
198 | d = bus_find_device(bus, NULL, (void *)phy_id, phy_compare_id); | ||
199 | |||
200 | if (d) { | ||
201 | phydev = to_phy_device(d); | ||
202 | } else { | ||
203 | printk(KERN_ERR "%s not found\n", phy_id); | ||
204 | return ERR_PTR(-ENODEV); | ||
205 | } | ||
206 | |||
207 | /* Assume that if there is no driver, that it doesn't | ||
208 | * exist, and we should use the genphy driver. */ | ||
209 | if (NULL == d->driver) { | ||
210 | int err; | ||
211 | down_write(&d->bus->subsys.rwsem); | ||
212 | d->driver = &genphy_driver.driver; | ||
213 | |||
214 | err = d->driver->probe(d); | ||
215 | |||
216 | if (err < 0) | ||
217 | return ERR_PTR(err); | ||
218 | |||
219 | device_bind_driver(d); | ||
220 | up_write(&d->bus->subsys.rwsem); | ||
221 | } | ||
222 | |||
223 | if (phydev->attached_dev) { | ||
224 | printk(KERN_ERR "%s: %s already attached\n", | ||
225 | dev->name, phy_id); | ||
226 | return ERR_PTR(-EBUSY); | ||
227 | } | ||
228 | |||
229 | phydev->attached_dev = dev; | ||
230 | |||
231 | phydev->dev_flags = flags; | ||
232 | |||
233 | return phydev; | ||
234 | } | ||
235 | EXPORT_SYMBOL(phy_attach); | ||
236 | |||
237 | void phy_detach(struct phy_device *phydev) | ||
238 | { | ||
239 | phydev->attached_dev = NULL; | ||
240 | |||
241 | /* If the device had no specific driver before (i.e. - it | ||
242 | * was using the generic driver), we unbind the device | ||
243 | * from the generic driver so that there's a chance a | ||
244 | * real driver could be loaded */ | ||
245 | if (phydev->dev.driver == &genphy_driver.driver) { | ||
246 | down_write(&phydev->dev.bus->subsys.rwsem); | ||
247 | device_release_driver(&phydev->dev); | ||
248 | up_write(&phydev->dev.bus->subsys.rwsem); | ||
249 | } | ||
250 | } | ||
251 | EXPORT_SYMBOL(phy_detach); | ||
252 | |||
253 | |||
254 | /* Generic PHY support and helper functions */ | 127 | /* Generic PHY support and helper functions */ |
255 | 128 | ||
256 | /* genphy_config_advert | 129 | /* genphy_config_advert |
@@ -259,7 +132,7 @@ EXPORT_SYMBOL(phy_detach); | |||
259 | * after sanitizing the values to make sure we only advertise | 132 | * after sanitizing the values to make sure we only advertise |
260 | * what is supported | 133 | * what is supported |
261 | */ | 134 | */ |
262 | int genphy_config_advert(struct phy_device *phydev) | 135 | static int genphy_config_advert(struct phy_device *phydev) |
263 | { | 136 | { |
264 | u32 advertise; | 137 | u32 advertise; |
265 | int adv; | 138 | int adv; |
@@ -317,7 +190,6 @@ int genphy_config_advert(struct phy_device *phydev) | |||
317 | 190 | ||
318 | return adv; | 191 | return adv; |
319 | } | 192 | } |
320 | EXPORT_SYMBOL(genphy_config_advert); | ||
321 | 193 | ||
322 | /* genphy_setup_forced | 194 | /* genphy_setup_forced |
323 | * | 195 | * |