Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp1745274rwe; Fri, 2 Sep 2022 03:10:00 -0700 (PDT) X-Google-Smtp-Source: AA6agR4wTYkqwDgUCHguOdrff/WWC7GbldTx0PuSIpS160YDbXd5cNZwRbZwBzckYePe28b6TyRP X-Received: by 2002:a63:2:0:b0:42f:6169:f396 with SMTP id 2-20020a630002000000b0042f6169f396mr13638328pga.249.1662113400513; Fri, 02 Sep 2022 03:10:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662113400; cv=none; d=google.com; s=arc-20160816; b=M77npzjVSnMMb7++zlHNSOGwaWxC5bgyh/uXC+3yJZQYH04v7LAOCAdksdKS/UdMqT hJ5qmJgp8QAfjtG/fLA1SaMv3EjkUW08AkjYPw/wzo6W/oFuprTHjDZCMHWdsIOCem66 Zc/mPjyakbUQUmkWj71aOAiM4VNCUyLpXAchfmZ9Rj+LHK9cAcqyNyCeEibwJDejq6VA jV8kawa3b8QavLbOV3jQtnHEl4o33Ku6/X2VG92uxu8UgiA4Wou0/jbIpWb0Cqu7jQEm ydakDydS/jMtVXiwJ9bMbUOLAzFdgL2RBEPYv53B7OCKnucAKkULx4MhGBrB9nA4besY U3kg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=mqECyM57GAXEal9PFKb4etCDhE3pjWGLEazyJc4htSc=; b=FDB03u83HEl110EYVhijJhcDA/t8Svxf/6rksuebV9VFMp7HJ3JPMl9h58BfE4IeJa gb437Dcvmld9CgYQRXktNQo7Vl3Q8dIMCMxz3c8M14kmSsaP18OlRD+eJIU7JtoGC071 EI1ONAdksTzTQ5zOqogB25/YW/wXwIaSGhfG9qo0sY5bJssZBXxXN5X4iFGQv6J+f5YP o1dgpu1EYFYfkV2lGcr8H3O0cj0Z1fcrEc5GGwisQohGe2k3efxtVpsy3KzzQnbmyjif DatIPmBwk73+sW7Im/+twFw9+o6K87XtdpUiWQnuJrvmWESKgr0mW+ytkeYxm0h+gjmZ DLnQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ABMcsnHy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r16-20020a635150000000b0042b0f80d8desi1658286pgl.36.2022.09.02.03.09.48; Fri, 02 Sep 2022 03:10:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ABMcsnHy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235486AbiIBJ4U (ORCPT + 99 others); Fri, 2 Sep 2022 05:56:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41404 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234698AbiIBJ4S (ORCPT ); Fri, 2 Sep 2022 05:56:18 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6F2642630; Fri, 2 Sep 2022 02:56:17 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 066AA61A18; Fri, 2 Sep 2022 09:56:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BD872C433D6; Fri, 2 Sep 2022 09:56:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1662112576; bh=lK6uUEPiahGzvtXOIT1ulXhRTu2SWh3dd06AnWyitao=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=ABMcsnHyBv9LgrXVUQrtNPCgT+nkgHFd/fVlWkKWEdFJBNngKsAY2gFAOxEvR7aw+ 20dJItIZcNUBiOoXmCbeHCS0/4WVnC6ZplP8Ju2XyPu5fLMiaLm32wVb34q/EzaIAT kqakFEllhXV7vepbdqZn0TzFKtFyevsnJhHxlrxI= Date: Fri, 2 Sep 2022 11:56:13 +0200 From: Greg KH To: Jiasheng Jiang 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 Message-ID: References: <20220902094423.4028673-1-jiasheng@iscas.ac.cn> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220902094423.4028673-1-jiasheng@iscas.ac.cn> X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 > --- > 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