From patchwork Sat Sep 3 05:11:17 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Torokhov X-Patchwork-Id: 602567 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 25C70C38145 for ; Sat, 3 Sep 2022 05:11:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231718AbiICFL0 (ORCPT ); Sat, 3 Sep 2022 01:11:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60704 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229667AbiICFLY (ORCPT ); Sat, 3 Sep 2022 01:11:24 -0400 Received: from mail-pg1-x530.google.com (mail-pg1-x530.google.com [IPv6:2607:f8b0:4864:20::530]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CD58769F77; Fri, 2 Sep 2022 22:11:23 -0700 (PDT) Received: by mail-pg1-x530.google.com with SMTP id h188so3606408pgc.12; Fri, 02 Sep 2022 22:11:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date; bh=mokK5Rr1KUt2vurzyDRQ+VKzKOENPW5x08AOXPXhhpo=; b=omygZnV2IE1nt8vp1ZM48uqVo5EEgyjXtEkQ8cZV3+RcFrzTLZKigMjGG1FBLeV+xc BMleZUr2C5X9F2m6XQgN8pIj1LWFzyPQ4lwxF6SGjm9qTZr0/jcTqHi8Gam5qc/DVPxW xUehlCaK1fqwRGYLwfGHXABDTJHbEj1ACBZ28ZvOn/cXwGRv4+/7ZjYa3Bm4Z+P0vHnX i0F5HmGgnsw0ABxPacUa9829zuejQ8Gl8ZK8KNcdC/JUzsXyITJ0UcptUENnfGTceflj ZCFX3UhUGBo91J7gpFmQvx7KFupcvXNWK3QpCiFTLAAMa7ehlmd8t0V9EYG2ZNVjeoB/ mfFA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date; bh=mokK5Rr1KUt2vurzyDRQ+VKzKOENPW5x08AOXPXhhpo=; b=m5qhY49b5jzSvnSDNxCbeRPHB9aqmlNYvfg3+1IlAnZVxU5vecxK5yJiNxA3BOxBb5 1ER6DFssF9om2iq8WuE/uz/Aqq3llPZbCM9ohyHNAwnrHDCwiYPQhqfj2knTS5FwsWtg 9PWEIllmsk6qKpEDCGAOunQH8Lnntarhz5fNrn+x2quprZ9YiEAC5tDFJzOdHuJVHy20 nenvOat4JHly2NSoJz4L4YZpSuXDtyqRdlhgKBB5SSXZP8plBJ64oCC+2CTRu6ruOqGO NYnV9IC1BKaYbwhKnUzQYm2MFdN7VbiNxPXa8i0/9JjmvoAqdaeQ5babO2814BJZgKno hMKw== X-Gm-Message-State: ACgBeo2ttCkx/18UBH2WYEAY2nVWjOjqx6UvCCznyY5mvPzbqSlVFwJI +fk4Tw899Ffiu5p27UuYFuMNOQQ6KIk= X-Google-Smtp-Source: AA6agR7i79NcTqYMdpPqG4vaKBiajtvObqm9/WCqk/mWiWi5FzLglbOdscM0Rr3BK/8eqKLMwos9zw== X-Received: by 2002:a63:6cc4:0:b0:41a:ff04:661f with SMTP id h187-20020a636cc4000000b0041aff04661fmr33231045pgc.600.1662181882937; Fri, 02 Sep 2022 22:11:22 -0700 (PDT) Received: from dtor-ws.mtv.corp.google.com ([2620:15c:202:201:ea21:afd4:e65e:539c]) by smtp.gmail.com with ESMTPSA id u1-20020a632341000000b0042a6dde1d66sm719571pgm.43.2022.09.02.22.11.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Sep 2022 22:11:22 -0700 (PDT) From: Dmitry Torokhov To: linux-input@vger.kernel.org, Greg Kroah-Hartman Cc: linux-kernel@vger.kernel.org Subject: [PATCH 1/3] Input: atkbd - switch to using dev_groups for driver-specific attributes Date: Fri, 2 Sep 2022 22:11:17 -0700 Message-Id: <20220903051119.1332808-1-dmitry.torokhov@gmail.com> X-Mailer: git-send-email 2.37.2.789.g6183377224-goog MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org The driver core now has the ability to handle the creation and removal of device-specific sysfs files, let's use it instead of registering and unregistering attributes by hand. Signed-off-by: Dmitry Torokhov Reviewed-by: Greg Kroah-Hartman Reviewed-by: Greg Kroah-Hartman --- drivers/input/keyboard/atkbd.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/drivers/input/keyboard/atkbd.c b/drivers/input/keyboard/atkbd.c index d4131236d18c..246958795f60 100644 --- a/drivers/input/keyboard/atkbd.c +++ b/drivers/input/keyboard/atkbd.c @@ -323,11 +323,13 @@ static umode_t atkbd_attr_is_visible(struct kobject *kobj, return attr->mode; } -static struct attribute_group atkbd_attribute_group = { +static const struct attribute_group atkbd_attribute_group = { .attrs = atkbd_attributes, .is_visible = atkbd_attr_is_visible, }; +__ATTRIBUTE_GROUPS(atkbd_attribute); + static const unsigned int xl_table[] = { ATKBD_RET_BAT, ATKBD_RET_ERR, ATKBD_RET_ACK, ATKBD_RET_NAK, ATKBD_RET_HANJA, ATKBD_RET_HANGEUL, @@ -922,8 +924,6 @@ static void atkbd_disconnect(struct serio *serio) { struct atkbd *atkbd = serio_get_drvdata(serio); - sysfs_remove_group(&serio->dev.kobj, &atkbd_attribute_group); - atkbd_disable(atkbd); input_unregister_device(atkbd->dev); @@ -1271,21 +1271,16 @@ static int atkbd_connect(struct serio *serio, struct serio_driver *drv) atkbd_set_keycode_table(atkbd); atkbd_set_device_attrs(atkbd); - err = sysfs_create_group(&serio->dev.kobj, &atkbd_attribute_group); - if (err) - goto fail3; - atkbd_enable(atkbd); if (serio->write) atkbd_activate(atkbd); err = input_register_device(atkbd->dev); if (err) - goto fail4; + goto fail3; return 0; - fail4: sysfs_remove_group(&serio->dev.kobj, &atkbd_attribute_group); fail3: serio_close(serio); fail2: serio_set_drvdata(serio, NULL); fail1: input_free_device(dev); @@ -1378,7 +1373,8 @@ MODULE_DEVICE_TABLE(serio, atkbd_serio_ids); static struct serio_driver atkbd_drv = { .driver = { - .name = "atkbd", + .name = "atkbd", + .dev_groups = atkbd_attribute_groups, }, .description = DRIVER_DESC, .id_table = atkbd_serio_ids, From patchwork Sat Sep 3 05:11:18 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Torokhov X-Patchwork-Id: 602688 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 701BAC38145 for ; Sat, 3 Sep 2022 05:11:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229667AbiICFLa (ORCPT ); Sat, 3 Sep 2022 01:11:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60812 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232026AbiICFL2 (ORCPT ); Sat, 3 Sep 2022 01:11:28 -0400 Received: from mail-pl1-x62c.google.com (mail-pl1-x62c.google.com [IPv6:2607:f8b0:4864:20::62c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0724F647FE; Fri, 2 Sep 2022 22:11:25 -0700 (PDT) Received: by mail-pl1-x62c.google.com with SMTP id d12so3737076plr.6; Fri, 02 Sep 2022 22:11:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date; bh=8uldbUkLZ5Arz8WmU1um7lfSedbFH8vdo+1QvNJr590=; b=ldmOkXekBEtH0b9zzQtlC9LfYTmFd0+FhzRkCOnrCnSTIJdmqQK5/9W7sNawXTyCKF GiL4reOLAoB4riO/G2nzfsnPLCO/dTIxV8IosO8C0cOATsH3pkPErc+tUlVVPkkAy2BR 3Eeow2YEoOzd2qvl+eu5bnIuz9ZU1Lfv3/d29NkK5PJ0AveyCpQY1qcBcc7i0erOSMv7 iE67JI69jH72+6jHogX9qrXkI2RSdGO0Vp+SwECuX+FerpJ37V1gS2WxSWtrW/JkDt15 7KZVYYmkNW15X0H9kQyiCjyPs7ddD0Xw8zIMmXzJBDLIWo2XQ4ncdU0o/q4BR7hGuDjk MvyQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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; bh=8uldbUkLZ5Arz8WmU1um7lfSedbFH8vdo+1QvNJr590=; b=wLdVwpr4itiCygpnkJ275yJ4jQwHMxvq+nTR6KRa6Rc1G0jClk6ss7h7a1aoZDRWkG scNi5d3kZOK7TNMuhV/HeiWsNmMCAOM70j5jGKdhJHv2tBlCUTGGMtAP5oAGezpm15Hd L3iKis2hrsLEJwCDTbSsPwN5+ryp9OSEym4/zksijdViz+AkxBfxID69pe2iBxMphOw7 RPhg1xdfO6vWYY8Ey+kFMZATW/WDNdivuK8z1B9LvvdQRtJsW4kmBl2chfjPztDXR0TD qn9th3VZWhJorY6jJTsOA6Y0g4/RWY0EAs/LsC8bNUzYILl5VkxMOPpzV9iaYpHwwstG o6Qw== X-Gm-Message-State: ACgBeo2AhJ8OGVSj0m+fdko2tL8lKMkSR8DMhL0y40z2ydSfL8Zp4Qxd zVmv/REEWR69FVlgY3Rav7dAjplJuAE= X-Google-Smtp-Source: AA6agR7lSU7bspUSBcG6wr7WTUx5qUq9cm4rdNwUTpDDGSXLxNg8KLfkB/2xN2qaFm6ZQ2wt/o1Prw== X-Received: by 2002:a17:902:6b07:b0:172:a76d:7cc5 with SMTP id o7-20020a1709026b0700b00172a76d7cc5mr38744601plk.128.1662181884027; Fri, 02 Sep 2022 22:11:24 -0700 (PDT) Received: from dtor-ws.mtv.corp.google.com ([2620:15c:202:201:ea21:afd4:e65e:539c]) by smtp.gmail.com with ESMTPSA id u1-20020a632341000000b0042a6dde1d66sm719571pgm.43.2022.09.02.22.11.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Sep 2022 22:11:23 -0700 (PDT) From: Dmitry Torokhov To: linux-input@vger.kernel.org, Greg Kroah-Hartman Cc: linux-kernel@vger.kernel.org Subject: [PATCH 2/3] Input: psmouse - switch to using dev_groups for driver-specific attributes Date: Fri, 2 Sep 2022 22:11:18 -0700 Message-Id: <20220903051119.1332808-2-dmitry.torokhov@gmail.com> X-Mailer: git-send-email 2.37.2.789.g6183377224-goog In-Reply-To: <20220903051119.1332808-1-dmitry.torokhov@gmail.com> References: <20220903051119.1332808-1-dmitry.torokhov@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org The driver core now has the ability to handle the creation and removal of device-specific sysfs files, let's use it instead of registering and unregistering attributes by hand. Signed-off-by: Dmitry Torokhov --- drivers/input/mouse/psmouse-base.c | 22 ++++------------------ 1 file changed, 4 insertions(+), 18 deletions(-) diff --git a/drivers/input/mouse/psmouse-base.c b/drivers/input/mouse/psmouse-base.c index 0b4a3039f312..c9a7e87b273e 100644 --- a/drivers/input/mouse/psmouse-base.c +++ b/drivers/input/mouse/psmouse-base.c @@ -94,7 +94,7 @@ PSMOUSE_DEFINE_ATTR(resync_time, S_IWUSR | S_IRUGO, (void *) offsetof(struct psmouse, resync_time), psmouse_show_int_attr, psmouse_set_int_attr); -static struct attribute *psmouse_attributes[] = { +static struct attribute *psmouse_dev_attrs[] = { &psmouse_attr_protocol.dattr.attr, &psmouse_attr_rate.dattr.attr, &psmouse_attr_resolution.dattr.attr, @@ -103,9 +103,7 @@ static struct attribute *psmouse_attributes[] = { NULL }; -static const struct attribute_group psmouse_attribute_group = { - .attrs = psmouse_attributes, -}; +ATTRIBUTE_GROUPS(psmouse_dev); /* * psmouse_mutex protects all operations changing state of mouse @@ -1481,8 +1479,6 @@ static void psmouse_disconnect(struct serio *serio) struct psmouse *psmouse = serio_get_drvdata(serio); struct psmouse *parent = NULL; - sysfs_remove_group(&serio->dev.kobj, &psmouse_attribute_group); - mutex_lock(&psmouse_mutex); psmouse_set_state(psmouse, PSMOUSE_CMD_MODE); @@ -1647,10 +1643,6 @@ static int psmouse_connect(struct serio *serio, struct serio_driver *drv) if (parent && parent->pt_activate) parent->pt_activate(parent); - error = sysfs_create_group(&serio->dev.kobj, &psmouse_attribute_group); - if (error) - goto err_pt_deactivate; - /* * PS/2 devices having SMBus companions should stay disabled * on PS/2 side, in order to have SMBus part operable. @@ -1666,13 +1658,6 @@ static int psmouse_connect(struct serio *serio, struct serio_driver *drv) mutex_unlock(&psmouse_mutex); return retval; - err_pt_deactivate: - if (parent && parent->pt_deactivate) - parent->pt_deactivate(parent); - if (input_dev) { - input_unregister_device(input_dev); - input_dev = NULL; /* so we don't try to free it below */ - } err_protocol_disconnect: if (psmouse->disconnect) psmouse->disconnect(psmouse); @@ -1791,7 +1776,8 @@ MODULE_DEVICE_TABLE(serio, psmouse_serio_ids); static struct serio_driver psmouse_drv = { .driver = { - .name = "psmouse", + .name = "psmouse", + .dev_groups = psmouse_dev_groups, }, .description = DRIVER_DESC, .id_table = psmouse_serio_ids, From patchwork Sat Sep 3 05:11:19 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Torokhov X-Patchwork-Id: 602566 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 625C9C54EE9 for ; Sat, 3 Sep 2022 05:11:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232062AbiICFLc (ORCPT ); Sat, 3 Sep 2022 01:11:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60818 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232032AbiICFL2 (ORCPT ); Sat, 3 Sep 2022 01:11:28 -0400 Received: from mail-pj1-x102d.google.com (mail-pj1-x102d.google.com [IPv6:2607:f8b0:4864:20::102d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 09A3869F77; Fri, 2 Sep 2022 22:11:26 -0700 (PDT) Received: by mail-pj1-x102d.google.com with SMTP id p8-20020a17090ad30800b001fdfc8c7567so8891200pju.1; Fri, 02 Sep 2022 22:11:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date; bh=0Gk7K6h0F1Pk4vJgzfMCBtymIV9nhuvTUp/dFq59Lg4=; b=atE+sw0GKhRf+Pk/s70pLvpfj5p/irVbjosPzsHJcmZ678VYHXaYRzitSLmyOi+MTA EVs80+i666t2vb/Wsmr+CXQbchSbPc1mMQO7wHV15tgclU3SW09+d36o/AcBuoueLVLQ jU2olKhTV51x7e/4Yn/7LF1fp6RVmMR3cMK74Ykq4CAVHafRFrmBl/FYPVR+FMUFSnP1 SBmnpacYr9Wo67HZKbcpYO99sgL4X/EJp2ag0J/gNPZJEdmw8J/Iyzeh2EPixUAEwiCl mtmu6wWESMuXNlymckTr2BWy7vB0rnEi2t5yB6Zx+au432kscGak7cZiyQHBSxILw2ny +uyA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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; bh=0Gk7K6h0F1Pk4vJgzfMCBtymIV9nhuvTUp/dFq59Lg4=; b=i6rGZ2qM0Bx2yJrD2mWymEwVaj0Xm590sUNe0KAcf6R05zrDyNjJ4jLcB7f9Gq1b2D DgI0AX0EXBA+Gyqp7+Ph2wsLb/sVhPapW59svT7iLdvd6sMh/Zo7TOSdvVHaTsjjpCNJ vwz2xtIuOuy2tYzXMEwE8fIq6LLD85cLDn4N5WQydPdr7ot6ETipdRo6kcNeTx5ZRQX0 dz71OdseDwCge7E48NjWrV/ZPYPj/LYJnosPfVZCtj1iHck7aZCqxl0Nf1YryGuO47wG 47a0zxwuGe7FFmktTWEZGXJs+up+Gyz8tDM6ZE2oAyWkXPAlP/jbYeeQIWO1cVWjyI+s YE1Q== X-Gm-Message-State: ACgBeo2UltdYeExClxKZPX9jC4BQz0K92EJiafrKLxqjgzJbIvIdXgmB SorHEVlbUlIFzVGHMd65m3kp8aG3AI4= X-Google-Smtp-Source: AA6agR5cKSdQCZByMJ4ARb66v/KR8SoCVwS9rRrDXNBKO43uAFlYA1zPpqWOPfVwZfAPbj/Wb8mLMQ== X-Received: by 2002:a17:90b:1d84:b0:1f5:b66:7460 with SMTP id pf4-20020a17090b1d8400b001f50b667460mr8572762pjb.50.1662181885180; Fri, 02 Sep 2022 22:11:25 -0700 (PDT) Received: from dtor-ws.mtv.corp.google.com ([2620:15c:202:201:ea21:afd4:e65e:539c]) by smtp.gmail.com with ESMTPSA id u1-20020a632341000000b0042a6dde1d66sm719571pgm.43.2022.09.02.22.11.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Sep 2022 22:11:24 -0700 (PDT) From: Dmitry Torokhov To: linux-input@vger.kernel.org, Greg Kroah-Hartman Cc: linux-kernel@vger.kernel.org Subject: [PATCH 3/3] Input: aiptek - switch to using dev_groups for driver-specific attributes Date: Fri, 2 Sep 2022 22:11:19 -0700 Message-Id: <20220903051119.1332808-3-dmitry.torokhov@gmail.com> X-Mailer: git-send-email 2.37.2.789.g6183377224-goog In-Reply-To: <20220903051119.1332808-1-dmitry.torokhov@gmail.com> References: <20220903051119.1332808-1-dmitry.torokhov@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org The driver core now has the ability to handle the creation and removal of device-specific sysfs files, let's use it instead of registering and unregistering attributes by hand. Signed-off-by: Dmitry Torokhov Reviewed-by: Greg Kroah-Hartman --- drivers/input/tablet/aiptek.c | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/drivers/input/tablet/aiptek.c b/drivers/input/tablet/aiptek.c index 24ec4844a5c3..baabc51547b8 100644 --- a/drivers/input/tablet/aiptek.c +++ b/drivers/input/tablet/aiptek.c @@ -1617,7 +1617,7 @@ static ssize_t show_firmwareCode(struct device *dev, struct device_attribute *at static DEVICE_ATTR(firmware_code, S_IRUGO, show_firmwareCode, NULL); -static struct attribute *aiptek_attributes[] = { +static struct attribute *aiptek_dev_attrs[] = { &dev_attr_size.attr, &dev_attr_pointer_mode.attr, &dev_attr_coordinate_mode.attr, @@ -1641,9 +1641,7 @@ static struct attribute *aiptek_attributes[] = { NULL }; -static const struct attribute_group aiptek_attribute_group = { - .attrs = aiptek_attributes, -}; +ATTRIBUTE_GROUPS(aiptek_dev); /*********************************************************************** * This routine is called when a tablet has been identified. It basically @@ -1842,26 +1840,16 @@ aiptek_probe(struct usb_interface *intf, const struct usb_device_id *id) */ usb_set_intfdata(intf, aiptek); - /* Set up the sysfs files - */ - err = sysfs_create_group(&intf->dev.kobj, &aiptek_attribute_group); - if (err) { - dev_warn(&intf->dev, "cannot create sysfs group err: %d\n", - err); - goto fail3; - } - /* Register the tablet as an Input Device */ err = input_register_device(aiptek->inputdev); if (err) { dev_warn(&intf->dev, "input_register_device returned err: %d\n", err); - goto fail4; + goto fail3; } return 0; - fail4: sysfs_remove_group(&intf->dev.kobj, &aiptek_attribute_group); fail3: usb_free_urb(aiptek->urb); fail2: usb_free_coherent(usbdev, AIPTEK_PACKET_LENGTH, aiptek->data, aiptek->data_dma); @@ -1886,7 +1874,6 @@ static void aiptek_disconnect(struct usb_interface *intf) */ usb_kill_urb(aiptek->urb); input_unregister_device(aiptek->inputdev); - sysfs_remove_group(&intf->dev.kobj, &aiptek_attribute_group); usb_free_urb(aiptek->urb); usb_free_coherent(interface_to_usbdev(intf), AIPTEK_PACKET_LENGTH, @@ -1900,6 +1887,7 @@ static struct usb_driver aiptek_driver = { .probe = aiptek_probe, .disconnect = aiptek_disconnect, .id_table = aiptek_ids, + .dev_groups = aiptek_dev_groups, }; module_usb_driver(aiptek_driver);