[13/22] Input: ili210x - use device core to create driver-specific device attributes
Message ID | 20230729005133.1095051-13-dmitry.torokhov@gmail.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:918b:0:b0:3e4:2afc:c1 with SMTP id s11csp814660vqg; Fri, 28 Jul 2023 19:56:53 -0700 (PDT) X-Google-Smtp-Source: APBJJlH4r8NbEV8504lXW1Jkq7Ar26zD1Wl3pRo/aIl90VRxxz4cU00cQdjzuttOMSzNyXYDtErX X-Received: by 2002:a05:6a20:1614:b0:135:110c:c6dd with SMTP id l20-20020a056a20161400b00135110cc6ddmr3595312pzj.53.1690599412971; Fri, 28 Jul 2023 19:56:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690599412; cv=none; d=google.com; s=arc-20160816; b=e7dScNoQDu3p5wHWZipXF8TEt7sr2QXF8Z8Km+dBOaNDVE0yz8EUuNP8JdrsMlMUh7 fWZm5Pl11rbrjTTWjGYqfeUf4buMRAK0vb6KihkJF1tR7w1LMeOdHcZihN1423MczM0v v3wgrN6WG0LMK1AdGRa2kh5XtyETUeygVW4q7YfREwrsLfqqBFSd+tbkru+CM5tZ9S6R Sx93u2L5pZoTCz49jFyUQleji9tOIXtJr8ROFiGjToYr8wQRBojkIIIRdbytLutloO2e /DHYpxkQaSNZBRmO6upVe8XmJo6dJsW5acGPM+TE6k9c36y8IqRb+tQuJoLv+3Fsbsjm i/hw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=qh239bx9Q1ammpCNJ5dKdqtd7HeLRoc7XKTXlpa6yXw=; fh=Cm/LvJVKCXECbP04MddzHe//WpuqrMlnLnW7fzx9ViY=; b=tZc3JakUDhdaAarFrzVh1WZjeJL9EsCdE96UQ5ZtK/u4iYMIXXqfM85tE9fBhdaHuN jXPT1A+JXW0pB3MGx2UsIUfv0nnKgWvl+pb0lggPaRSMftwwCok3d0xEKX57z1O2yDP4 WXiC8ys2hLYeUu5WYx4dzZDojq6HhU4EMzsDEZa/i7sRoVTT6De8pQsnrw7c+IIikBEI Yr0ZZR8Zg+dgol2zFTSwoPXXtrEmAY847nK8FP0d02IPdCpIrz4/M5JnwHfTDVUW7KN/ djsFIwr32MYb63BkRAvJ4DlKuWFNiKZMIVk6phtjZhZ23HpZ2hiiCwLDzsSpsmrqSlD3 gRIA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b="psXW/SFe"; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s1-20020a63dc01000000b0055c89e686a9si3929446pgg.10.2023.07.28.19.56.39; Fri, 28 Jul 2023 19:56:52 -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=@gmail.com header.s=20221208 header.b="psXW/SFe"; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237108AbjG2AyS (ORCPT <rfc822;hanasaki@gmail.com> + 99 others); Fri, 28 Jul 2023 20:54:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45960 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233739AbjG2Ax0 (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Fri, 28 Jul 2023 20:53:26 -0400 Received: from mail-pl1-x62a.google.com (mail-pl1-x62a.google.com [IPv6:2607:f8b0:4864:20::62a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 464B049D8; Fri, 28 Jul 2023 17:53:03 -0700 (PDT) Received: by mail-pl1-x62a.google.com with SMTP id d9443c01a7336-1bb8e45185bso17379605ad.1; Fri, 28 Jul 2023 17:53:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1690591907; x=1691196707; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=qh239bx9Q1ammpCNJ5dKdqtd7HeLRoc7XKTXlpa6yXw=; b=psXW/SFetN1vx8Gdl0lLaxC3tlWzZe7SSBV4JnyDhjqn2A5jFZLilEypT6NlgC/epJ Kw9NIdWGYzfIrRxq5R32FmjNwWqMJOrW2IpDxj0IWfqVMsSvjy/Us8sTjS8VujCEvia+ XozD0pFOIg6j2qUah21ytpAd6qUAFMNiKX2x7i0EaYtu+mjxHWycRBNrWRC23ctN4tnm yMEk32ZadqU4OVPBoVyWOAzJ+KvtIVe/OcJC4OZC5sFG11vGMWJdZQ9cu4PwEo1RIFOH WXx0CNxVDGaqbSNYVHk1KyyGaxKkzZeQETxm9ZUQBTe3YfIi2HTV8fyybHHkTr0p0d8Y o26A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690591907; x=1691196707; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=qh239bx9Q1ammpCNJ5dKdqtd7HeLRoc7XKTXlpa6yXw=; b=CWxx3DFipgQWzzi1O076ru5R/U1RPp2zS8ZqaNMo3TmpCzU3gNBhhtsE58RM8rQT0Q j8I7yKM20AHfjuGe8OwD0+F1qdNLUkBZBrTsbcoia19MVbBUAJ78JI5tmMNTJSoKQWOr DeDj8x/Vgct4Am1r6Yqrteu8PHrVyZJR5WdpLzJvZkwcYICfuhG7LC6v2/0czeS4e9xt 9yxhDY5xuZ9twwZur05RTaKCf7PtX9ieoLsSNyXS4Qslm6KYoVZRZeOs3OK36dRwlawS lH3TXGD9s93+vCa55fQkyP7EKR82T29tZgdy423/Mov54xtJ4BWx/4eS1Uuef/NToasO EF+A== X-Gm-Message-State: ABy/qLYb1LEctRzd8xgZfURjbc3247CrbUryWF9l7IPFYbqg48lquAC1 mDkD+Kj5/HcB3Mha5DnohBtaMnffzh4= X-Received: by 2002:a17:902:f547:b0:1ba:fe63:6616 with SMTP id h7-20020a170902f54700b001bafe636616mr3311407plf.6.1690591906665; Fri, 28 Jul 2023 17:51:46 -0700 (PDT) Received: from dtor-ws.mtv.corp.google.com ([2620:15c:9d:2:bc93:3749:59cc:1d5c]) by smtp.gmail.com with ESMTPSA id h12-20020a170902704c00b001bb97e51ab4sm4149524plt.98.2023.07.28.17.51.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 28 Jul 2023 17:51:46 -0700 (PDT) From: Dmitry Torokhov <dmitry.torokhov@gmail.com> To: linux-input@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Greg Kroah-Hartman <gregkh@linuxfoundation.org>, Marek Vasut <marex@denx.de> Subject: [PATCH 13/22] Input: ili210x - use device core to create driver-specific device attributes Date: Fri, 28 Jul 2023 17:51:22 -0700 Message-ID: <20230729005133.1095051-13-dmitry.torokhov@gmail.com> X-Mailer: git-send-email 2.41.0.487.g6d72f3e995-goog In-Reply-To: <20230729005133.1095051-1-dmitry.torokhov@gmail.com> References: <20230729005133.1095051-1-dmitry.torokhov@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1772721970126598253 X-GMAIL-MSGID: 1772721970126598253 |
Series |
[01/22] Input: cros_ec_keyb - use device core to create driver-specific device attributes
|
|
Commit Message
Dmitry Torokhov
July 29, 2023, 12:51 a.m. UTC
Instead of creating driver-specific device attributes with
devm_device_add_group() have device core do this by setting up dev_groups
pointer in the driver structure.
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
---
drivers/input/touchscreen/ili210x.c | 15 +++++----------
1 file changed, 5 insertions(+), 10 deletions(-)
Comments
On 7/29/23 02:51, Dmitry Torokhov wrote: > Instead of creating driver-specific device attributes with > devm_device_add_group() have device core do this by setting up dev_groups > pointer in the driver structure. > > Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com> > --- > drivers/input/touchscreen/ili210x.c | 15 +++++---------- > 1 file changed, 5 insertions(+), 10 deletions(-) > > diff --git a/drivers/input/touchscreen/ili210x.c b/drivers/input/touchscreen/ili210x.c > index ad6828e4f2e2..31ffdc2a93f3 100644 > --- a/drivers/input/touchscreen/ili210x.c > +++ b/drivers/input/touchscreen/ili210x.c > @@ -876,7 +876,7 @@ static ssize_t ili210x_firmware_update_store(struct device *dev, > > static DEVICE_ATTR(firmware_update, 0200, NULL, ili210x_firmware_update_store); > > -static struct attribute *ili210x_attributes[] = { > +static struct attribute *ili210x_attrs[] = { > &dev_attr_calibrate.attr, > &dev_attr_firmware_update.attr, > &dev_attr_firmware_version.attr, > @@ -904,10 +904,11 @@ static umode_t ili210x_attributes_visible(struct kobject *kobj, > return attr->mode; > } > > -static const struct attribute_group ili210x_attr_group = { > - .attrs = ili210x_attributes, > +static const struct attribute_group ili210x_group = { > + .attrs = ili210x_attrs, Is all the renaming really necessary and relevant to this patch ? btw since I have your attention, could you also look at discussion [PATCH] Input: pwm-beeper - Support volume setting via sysfs ? I've been waiting for any maintainer input for over two months now. Thanks
On Sat, Jul 29, 2023 at 05:07:17PM +0200, Marek Vasut wrote: > On 7/29/23 02:51, Dmitry Torokhov wrote: > > Instead of creating driver-specific device attributes with > > devm_device_add_group() have device core do this by setting up dev_groups > > pointer in the driver structure. > > > > Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com> > > --- > > drivers/input/touchscreen/ili210x.c | 15 +++++---------- > > 1 file changed, 5 insertions(+), 10 deletions(-) > > > > diff --git a/drivers/input/touchscreen/ili210x.c b/drivers/input/touchscreen/ili210x.c > > index ad6828e4f2e2..31ffdc2a93f3 100644 > > --- a/drivers/input/touchscreen/ili210x.c > > +++ b/drivers/input/touchscreen/ili210x.c > > @@ -876,7 +876,7 @@ static ssize_t ili210x_firmware_update_store(struct device *dev, > > static DEVICE_ATTR(firmware_update, 0200, NULL, ili210x_firmware_update_store); > > -static struct attribute *ili210x_attributes[] = { > > +static struct attribute *ili210x_attrs[] = { > > &dev_attr_calibrate.attr, > > &dev_attr_firmware_update.attr, > > &dev_attr_firmware_version.attr, > > @@ -904,10 +904,11 @@ static umode_t ili210x_attributes_visible(struct kobject *kobj, > > return attr->mode; > > } > > -static const struct attribute_group ili210x_attr_group = { > > - .attrs = ili210x_attributes, > > +static const struct attribute_group ili210x_group = { > > + .attrs = ili210x_attrs, > > Is all the renaming really necessary and relevant to this patch ? Yes, it's needed for the __ATTRIBUTE_GROUPS() macro. thanks, greg k-h
On 7/30/23 13:38, Greg Kroah-Hartman wrote: > On Sat, Jul 29, 2023 at 05:07:17PM +0200, Marek Vasut wrote: >> On 7/29/23 02:51, Dmitry Torokhov wrote: >>> Instead of creating driver-specific device attributes with >>> devm_device_add_group() have device core do this by setting up dev_groups >>> pointer in the driver structure. >>> >>> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com> >>> --- >>> drivers/input/touchscreen/ili210x.c | 15 +++++---------- >>> 1 file changed, 5 insertions(+), 10 deletions(-) >>> >>> diff --git a/drivers/input/touchscreen/ili210x.c b/drivers/input/touchscreen/ili210x.c >>> index ad6828e4f2e2..31ffdc2a93f3 100644 >>> --- a/drivers/input/touchscreen/ili210x.c >>> +++ b/drivers/input/touchscreen/ili210x.c >>> @@ -876,7 +876,7 @@ static ssize_t ili210x_firmware_update_store(struct device *dev, >>> static DEVICE_ATTR(firmware_update, 0200, NULL, ili210x_firmware_update_store); >>> -static struct attribute *ili210x_attributes[] = { >>> +static struct attribute *ili210x_attrs[] = { >>> &dev_attr_calibrate.attr, >>> &dev_attr_firmware_update.attr, >>> &dev_attr_firmware_version.attr, >>> @@ -904,10 +904,11 @@ static umode_t ili210x_attributes_visible(struct kobject *kobj, >>> return attr->mode; >>> } >>> -static const struct attribute_group ili210x_attr_group = { >>> - .attrs = ili210x_attributes, >>> +static const struct attribute_group ili210x_group = { >>> + .attrs = ili210x_attrs, >> >> Is all the renaming really necessary and relevant to this patch ? > > Yes, it's needed for the __ATTRIBUTE_GROUPS() macro. Ah ok
diff --git a/drivers/input/touchscreen/ili210x.c b/drivers/input/touchscreen/ili210x.c index ad6828e4f2e2..31ffdc2a93f3 100644 --- a/drivers/input/touchscreen/ili210x.c +++ b/drivers/input/touchscreen/ili210x.c @@ -876,7 +876,7 @@ static ssize_t ili210x_firmware_update_store(struct device *dev, static DEVICE_ATTR(firmware_update, 0200, NULL, ili210x_firmware_update_store); -static struct attribute *ili210x_attributes[] = { +static struct attribute *ili210x_attrs[] = { &dev_attr_calibrate.attr, &dev_attr_firmware_update.attr, &dev_attr_firmware_version.attr, @@ -904,10 +904,11 @@ static umode_t ili210x_attributes_visible(struct kobject *kobj, return attr->mode; } -static const struct attribute_group ili210x_attr_group = { - .attrs = ili210x_attributes, +static const struct attribute_group ili210x_group = { + .attrs = ili210x_attrs, .is_visible = ili210x_attributes_visible, }; +__ATTRIBUTE_GROUPS(ili210x); static void ili210x_power_down(void *data) { @@ -1013,13 +1014,6 @@ static int ili210x_i2c_probe(struct i2c_client *client) if (error) return error; - error = devm_device_add_group(dev, &ili210x_attr_group); - if (error) { - dev_err(dev, "Unable to create sysfs attributes, err: %d\n", - error); - return error; - } - error = input_register_device(priv->input); if (error) { dev_err(dev, "Cannot register input device, err: %d\n", error); @@ -1050,6 +1044,7 @@ MODULE_DEVICE_TABLE(of, ili210x_dt_ids); static struct i2c_driver ili210x_ts_driver = { .driver = { .name = "ili210x_i2c", + .dev_groups = ili210x_groups, .of_match_table = ili210x_dt_ids, }, .id_table = ili210x_i2c_id,