All of lore.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <gregkh@linuxfoundation.org>
To: Jiasheng Jiang <jiasheng@iscas.ac.cn>
Cc: johan@kernel.org, linux-usb@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3] USB: serial: ftdi_sio: Convert to use dev_groups
Date: Fri, 2 Sep 2022 11:56:13 +0200	[thread overview]
Message-ID: <YxHTPb8aWhkqEr8t@kroah.com> (raw)
In-Reply-To: <20220902094423.4028673-1-jiasheng@iscas.ac.cn>

On Fri, Sep 02, 2022 at 05:44:23PM +0800, Jiasheng Jiang wrote:
> The driver core supports the ability to handle the creation and removal
> of device-specific sysfs files in a race-free manner. Moreover, it can
> guarantee the success of creation. Therefore, it should be better to
> convert to use dev_groups.
> 
> Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
> ---
> Changelog:
> 
> v2 -> v3:
> 
> 1. Add is_visible to filter the unneeded files.
> 
> v1 -> v2:
> 
> 1. Change the title.
> 2. Switch to use an attribute group.
> ---
>  drivers/usb/serial/ftdi_sio.c | 101 +++++++++++++++++-----------------
>  1 file changed, 51 insertions(+), 50 deletions(-)
> 
> diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c
> index d5a3986dfee7..479c3a5caaf8 100644
> --- a/drivers/usb/serial/ftdi_sio.c
> +++ b/drivers/usb/serial/ftdi_sio.c
> @@ -1107,11 +1107,40 @@ static u32 ftdi_232bm_baud_base_to_divisor(int baud, int base);
>  static u32 ftdi_232bm_baud_to_divisor(int baud);
>  static u32 ftdi_2232h_baud_base_to_divisor(int baud, int base);
>  static u32 ftdi_2232h_baud_to_divisor(int baud);
> +static umode_t ftdi_sio_attr_is_visible(struct kobject *kobj,
> +					 struct attribute *attr, int idx);
> +static ssize_t latency_timer_store(struct device *dev,
> +				   struct device_attribute *attr,
> +				   const char *valbuf, size_t count);
> +static ssize_t event_char_store(struct device *dev,
> +	struct device_attribute *attr, const char *valbuf, size_t count);
> +static ssize_t latency_timer_show(struct device *dev,
> +				  struct device_attribute *attr, char *buf);
> +

Please work with the code so that you do not have to pre-define these
functions.  It should be possible.  Worst case, you pre-define the
structure for the driver, that should be it.

And again, have you tested this change?

thanks,

greg k-h

      reply	other threads:[~2022-09-02  9:56 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-02  9:44 [PATCH v3] USB: serial: ftdi_sio: Convert to use dev_groups Jiasheng Jiang
2022-09-02  9:56 ` Greg KH [this message]

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=YxHTPb8aWhkqEr8t@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=jiasheng@iscas.ac.cn \
    --cc=johan@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    /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.