All of lore.kernel.org
 help / color / mirror / Atom feed
From: Yajun Deng <yajun.deng@linux.dev>
To: Greg KH <gregkh@linuxfoundation.org>
Cc: marcel@holtmann.org, johan.hedberg@gmail.com,
	luiz.dentz@gmail.com, wg@grandegger.com, mkl@pengutronix.de,
	aspriel@gmail.com, franky.lin@broadcom.com,
	hante.meuleman@broadcom.com, kvalo@kernel.org,
	briannorris@chromium.org, mka@chromium.org, johan@kernel.org,
	oneukum@suse.com, stern@rowland.harvard.edu,
	valentina.manea.m@gmail.com, shuah@kernel.org,
	linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] USB: core: Use device_driver directly in struct usb_driver and usb_device_driver
Date: Fri, 15 Dec 2023 21:23:12 +0800	[thread overview]
Message-ID: <09d43174-03fc-abb8-db28-b0fb338492f1@linux.dev> (raw)
In-Reply-To: <2023121505-dexterity-rectal-8898@gregkh>


On 2023/12/15 20:40, Greg KH wrote:
> On Fri, Dec 15, 2023 at 02:31:01PM +0800, Yajun Deng wrote:
>> There is usbdrv_wrap in struct usb_driver and usb_device_driver,
>> it contains device_driver and for_devices. for_devices is used to
>> distinguish between device drivers and interface drivers.
> Yes.
>
>> We can compare that if 'drv->probe' is equal to usb_probe_device instead
>> of using for_devices in is_usb_device_driver().
> Why?


For remove struct usbdrv_wrap. As we can see,  other structs use 
device_driver directly.

struct sdio_driver {

... ...

         struct device_driver drv;
};


struct pcie_port_service_driver {

... ...

         struct device_driver driver;
};

and so on ...

So there is no need a wrapper for device_driver if we can implement 
is_usb_device_driver().

>
>> Remove struct usbdrv_wrap, use device_driver directly in struct usb_driver
>> and usb_device_driver. This makes the code more concise.
> Really?  What does this help out with?  Are there future changes that
> require this?


No, just for cleanups and consistency with other structs.

> I'm all for cleanups, but I don't see what this helps with.
>
> Also, you have a coding style issue in this patch, which means I
> couldn't take it anyway:
>
>> +extern int usb_probe_device(struct device *dev);
> We don't do that in .c files :(


It's in drivers/usb/core/usb.h, not in .c files.

>
> thanks,
>
> greg k-h

  reply	other threads:[~2023-12-15 13:23 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-15  6:31 [PATCH] USB: core: Use device_driver directly in struct usb_driver and usb_device_driver Yajun Deng
2023-12-15 12:40 ` Greg KH
2023-12-15 13:23   ` Yajun Deng [this message]
2023-12-15 15:50 ` Alan Stern

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=09d43174-03fc-abb8-db28-b0fb338492f1@linux.dev \
    --to=yajun.deng@linux.dev \
    --cc=aspriel@gmail.com \
    --cc=briannorris@chromium.org \
    --cc=franky.lin@broadcom.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=hante.meuleman@broadcom.com \
    --cc=johan.hedberg@gmail.com \
    --cc=johan@kernel.org \
    --cc=kvalo@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=luiz.dentz@gmail.com \
    --cc=marcel@holtmann.org \
    --cc=mka@chromium.org \
    --cc=mkl@pengutronix.de \
    --cc=oneukum@suse.com \
    --cc=shuah@kernel.org \
    --cc=stern@rowland.harvard.edu \
    --cc=valentina.manea.m@gmail.com \
    --cc=wg@grandegger.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.