Re: [PATCH] usb: ulpi: don't register drivers if bus doesn't exist

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, May 25, 2015 at 02:40:10PM +0300, Heikki Krogerus wrote:
> Hi,
> 
> > Why do we even need that? If you take patch that makes ulpi_init a
> > subsys_initcall you won't have this problem, and no additional weird
> > hacks and errors will be needed
> 
> Using subsys_initcall will work around the problem for now, but I
> would not make the assumption that there will never be ulpi phy
> drivers and ulpi interface drivers that don't use subsys_initcall
> themselves. By checking the old phy drivers at drivers/usb/phy/, at
> least so far it hasn't been uncommon for them to use subsys_initcall.
> 
> I would much prefer to have a proper fix for this issue instead of
> just working around it, but we need to use subsys_initcall in any
> case.
> 
> > >> > +   /* Was the bus registered successfully? */
> > >> > +   if (!ulpi_bus.p)
> > >> > +           return -ENODEV;
> > >>
> > >> Ick, no, don't go mucking around in the bus internals like this, that's
> > >> not ok.  You should either "know" the bus is registered, or something is
> > >> really wrong with the design here.
> > > can't we use a variable which can be initialized to 1 in ulpi_init() if
> > > the bus registers successfully and later check that?
> 
> Just a note. We should also be aware if the bus registration failed or
> if it just hasn't been loaded yet.
> 
> If we used a variable like that, I guess it could initially have the
> value -EAGAIN. If bus_register returns error, we store -ENODEV to it.
> If bus_register succeeds we store 0 to it. I don't know if we can just
> store the return value from bus_register to it.
> 
> In ulpi_register_driver and ulpi_register_interface we can then just
> return it if it has a value other then 0.
> 
> But couldn't we add a helper function to drivers/base/bus.c that the
> bus drivers can use to at least check was the bus already loaded or
> not? It looks like there are a couple of bus drivers that use the
> struct bus member "p" to check that.
> 
> Greg, what do you think?

I think your design is wrong if you need to worry about this :)

If there are other bus drivers that do this, I'll go fix them up,
pointers to those files would be appreciated.

thanks,

greg k-h
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux