From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Darren Hart <dvhart@infradead.org>,
Andy Shevchenko <andy@infradead.org>,
Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
"H. Peter Anvin" <hpa@zytor.com>,
x86@kernel.org, platform-driver-x86@vger.kernel.org
Subject: [PATCH 05/11] olpc: x01: convert platform driver to use dev_groups
Date: Thu, 4 Jul 2019 10:46:11 +0200 [thread overview]
Message-ID: <20190704084617.3602-6-gregkh@linuxfoundation.org> (raw)
In-Reply-To: <20190704084617.3602-1-gregkh@linuxfoundation.org>
Platform drivers now have the option to have the platform core create
and remove any needed sysfs attribute files. So take advantage of that
and do not register "by hand" a lid sysfs file.
Cc: Darren Hart <dvhart@infradead.org>
Cc: Andy Shevchenko <andy@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Borislav Petkov <bp@alien8.de>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: x86@kernel.org
Cc: platform-driver-x86@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
arch/x86/platform/olpc/olpc-xo1-sci.c | 17 +++++++----------
1 file changed, 7 insertions(+), 10 deletions(-)
diff --git a/arch/x86/platform/olpc/olpc-xo1-sci.c b/arch/x86/platform/olpc/olpc-xo1-sci.c
index 25ce1b3b0732..ce1948918dd2 100644
--- a/arch/x86/platform/olpc/olpc-xo1-sci.c
+++ b/arch/x86/platform/olpc/olpc-xo1-sci.c
@@ -157,6 +157,12 @@ static ssize_t lid_wake_mode_set(struct device *dev,
static DEVICE_ATTR(lid_wake_mode, S_IWUSR | S_IRUGO, lid_wake_mode_show,
lid_wake_mode_set);
+static struct attribute *lid_attrs[] = {
+ &dev_attr_lid_wake_mode.attr,
+ NULL,
+};
+ATTRIBUTE_GROUPS(lid);
+
/*
* Process all items in the EC's SCI queue.
*
@@ -510,17 +516,8 @@ static int setup_lid_switch(struct platform_device *pdev)
goto err_register;
}
- r = device_create_file(&lid_switch_idev->dev, &dev_attr_lid_wake_mode);
- if (r) {
- dev_err(&pdev->dev, "failed to create wake mode attr: %d\n", r);
- goto err_create_attr;
- }
-
return 0;
-err_create_attr:
- input_unregister_device(lid_switch_idev);
- lid_switch_idev = NULL;
err_register:
input_free_device(lid_switch_idev);
return r;
@@ -528,7 +525,6 @@ static int setup_lid_switch(struct platform_device *pdev)
static void free_lid_switch(void)
{
- device_remove_file(&lid_switch_idev->dev, &dev_attr_lid_wake_mode);
input_unregister_device(lid_switch_idev);
}
@@ -629,6 +625,7 @@ static struct platform_driver xo1_sci_driver = {
.remove = xo1_sci_remove,
.suspend = xo1_sci_suspend,
.resume = xo1_sci_resume,
+ .dev_groups = lid_groups,
};
static int __init xo1_sci_init(void)
--
2.22.0
next prev parent reply other threads:[~2019-07-04 8:47 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-04 8:46 [PATCH 00/11] Platform drivers, provide a way to add sysfs groups easily Greg Kroah-Hartman
2019-07-04 8:46 ` [PATCH 01/11] Platform: add a dev_groups pointer to struct platform_driver Greg Kroah-Hartman
2019-07-04 9:32 ` Johan Hovold
2019-07-04 10:43 ` Greg Kroah-Hartman
2019-07-04 12:11 ` [PATCH 01/12 v2] " Greg Kroah-Hartman
2019-07-04 21:17 ` Dmitry Torokhov
2019-07-06 8:32 ` Greg Kroah-Hartman
2019-07-06 17:04 ` Dmitry Torokhov
2019-07-06 17:19 ` Greg Kroah-Hartman
2019-07-06 17:39 ` Dmitry Torokhov
2019-07-19 11:52 ` Greg Kroah-Hartman
2019-07-20 4:38 ` Dmitry Torokhov
2019-07-25 13:44 ` Greg Kroah-Hartman
2019-07-25 19:02 ` Richard Gong
2019-07-25 19:04 ` Greg Kroah-Hartman
2019-07-25 19:13 ` Dmitry Torokhov
2019-07-25 19:18 ` Dmitry Torokhov
2019-07-04 8:46 ` [PATCH 02/11] uio: uio_fsl_elbc_gpcm: convert platform driver to use dev_groups Greg Kroah-Hartman
2019-07-04 8:46 ` [PATCH 03/11] serial: sh-sci: use driver core functions, not sysfs ones Greg Kroah-Hartman
2019-07-04 8:46 ` [PATCH 04/11] firmware: arm_scpi: convert platform driver to use dev_groups Greg Kroah-Hartman
2019-07-04 9:10 ` Sudeep Holla
2019-07-31 12:28 ` Greg Kroah-Hartman
2019-07-04 8:46 ` Greg Kroah-Hartman [this message]
2019-07-04 13:28 ` [PATCH 05/11] olpc: x01: " Andy Shevchenko
2019-07-04 8:46 ` [PATCH 06/11] platform: x86: hp-wmi: " Greg Kroah-Hartman
2019-07-04 13:29 ` Andy Shevchenko
2019-07-04 8:46 ` [PATCH 07/11] video: fbdev: wm8505fb: " Greg Kroah-Hartman
2019-07-04 13:29 ` Andy Shevchenko
2019-07-04 14:25 ` Greg Kroah-Hartman
2019-07-04 8:46 ` [PATCH 08/11] video: fbdev: w100fb: " Greg Kroah-Hartman
2019-07-05 15:01 ` Bartlomiej Zolnierkiewicz
2019-07-04 8:46 ` [PATCH 09/11] video: fbdev: sm501fb: " Greg Kroah-Hartman
2019-07-05 15:01 ` Bartlomiej Zolnierkiewicz
2019-07-04 8:46 ` [PATCH 10/11] input: keyboard: gpio_keys: " Greg Kroah-Hartman
2019-07-04 8:46 ` [PATCH 11/11] input: axp20x-pek: " Greg Kroah-Hartman
2019-07-04 14:26 ` [PATCH 07/11] video: fbdev: wm8505fb: " Greg Kroah-Hartman
2019-07-05 15:00 ` Bartlomiej Zolnierkiewicz
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=20190704084617.3602-6-gregkh@linuxfoundation.org \
--to=gregkh@linuxfoundation.org \
--cc=andy@infradead.org \
--cc=bp@alien8.de \
--cc=dvhart@infradead.org \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=platform-driver-x86@vger.kernel.org \
--cc=tglx@linutronix.de \
--cc=x86@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).