On Fri, Dec 01, 2023 at 10:29:50AM -0800, Douglas Anderson wrote: > There's no real reason that subclassed USB drivers _need_ to define > probe() since they might want to subclass for some other reason. Make > it optional to define probe() if we're a generic_subclass. > > Signed-off-by: Douglas Anderson <dianders@xxxxxxxxxxxx> > --- Reviewed-by: Alan Stern <stern@xxxxxxxxxxxxxxxxxxx> > Changes in v2: > - ("Don't force USB generic_subclass drivers to define ...") new for v2. > > drivers/usb/core/driver.c | 5 ++++- > 1 file changed, 4 insertions(+), 1 deletion(-) > > diff --git a/drivers/usb/core/driver.c b/drivers/usb/core/driver.c > index f58a0299fb3b..1dc0c0413043 100644 > --- a/drivers/usb/core/driver.c > +++ b/drivers/usb/core/driver.c > @@ -290,7 +290,10 @@ static int usb_probe_device(struct device *dev) > * specialised device drivers prior to setting the > * use_generic_driver bit. > */ > - error = udriver->probe(udev); > + if (udriver->probe) > + error = udriver->probe(udev); > + else if (!udriver->generic_subclass) > + error = -EINVAL; > if (error == -ENODEV && udriver != &usb_generic_driver && > (udriver->id_table || udriver->match)) { > udev->use_generic_driver = 1; > -- > 2.43.0.rc2.451.g8631bc7472-goog >