[PATCH 1/3 v2] net: introduce phylib

Sascha Hauer s.hauer at pengutronix.de
Tue Sep 11 05:09:06 EDT 2012


On Mon, Sep 10, 2012 at 03:08:00PM +0200, Jean-Christophe PLAGNIOL-VILLARD wrote:
> On 09:14 Mon 10 Sep     , Sascha Hauer wrote:
> > On Sun, Sep 09, 2012 at 05:44:00PM +0200, Jean-Christophe PLAGNIOL-VILLARD wrote:
> > > +
> > > +	drv->config_init(dev);
> > 
> > Call _dev->driver->probe instead? A phy driver would have to convert the
> > device argument to a phy_device using to_phy_device(), but this would be
> > the same as other subsystems do it currently.
> 
> the phy probe is the for the driver which I did not add but I could 
> here the config_init is correct

I have assumed that phy drivers would need the opportunity to allocate
memory, and hence also to free it on remove. Appearantly this is not
the case, even in Linux. So ok, let's keep it this way.

> > 
> > > +
> > > +static void phy_remove(struct device_d *dev)
> > > +{
> > > +}
> > > +
> > > +struct bus_type phy_bustype = {
> > > +	.name = "phy",
> > > +	.match = phy_match,
> > > +	.probe = phy_probe,
> > > +	.remove = phy_remove,
> > 
> > Then you could just remove the .remove callback which has the effect
> > that a phy drivers .remove function would be called.
> the generic code make the remove mandatory

Indeed, I thought the generic code bahaves differently here.

Sascha

> 
> > 
> > > +};
> > > +
> > > +int phy_driver_register(struct phy_driver *phydrv)
> > > +{
> > > +	if (!phydrv)
> > > +		return -1;
> > 
> > Drop this check. A stack dump contains more information than an error
> > code that nobody checks. EPERM would be the wrong error code anyway.

Would you mind dropping this? Then we are free to go.

Sascha


-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



More information about the barebox mailing list