From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: htejun@gmail.com, linux-kernel@vger.kernel.org,
Guenter Roeck <linux@roeck-us.net>
Subject: [PATCH v2 2/7] driver core: make device_{add|remove}_groups() public
Date: Wed, 19 Jul 2017 17:24:31 -0700 [thread overview]
Message-ID: <20170720002436.29309-3-dmitry.torokhov@gmail.com> (raw)
In-Reply-To: <20170720002436.29309-1-dmitry.torokhov@gmail.com>
Many drivers create additional driver-specific device attributes when
binding to the device. To avoid them calling SYSFS API directly, let's
export these helpers.
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
---
drivers/base/base.h | 5 -----
drivers/base/core.c | 2 ++
include/linux/device.h | 5 +++++
3 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/drivers/base/base.h b/drivers/base/base.h
index e19b1008e5fb..539432a14b5c 100644
--- a/drivers/base/base.h
+++ b/drivers/base/base.h
@@ -126,11 +126,6 @@ extern int driver_add_groups(struct device_driver *drv,
extern void driver_remove_groups(struct device_driver *drv,
const struct attribute_group **groups);
-extern int device_add_groups(struct device *dev,
- const struct attribute_group **groups);
-extern void device_remove_groups(struct device *dev,
- const struct attribute_group **groups);
-
extern char *make_class_name(const char *name, struct kobject *kobj);
extern int devres_release_all(struct device *dev);
diff --git a/drivers/base/core.c b/drivers/base/core.c
index bbecaf9293be..14f8cf5c8b05 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -1026,12 +1026,14 @@ int device_add_groups(struct device *dev, const struct attribute_group **groups)
{
return sysfs_create_groups(&dev->kobj, groups);
}
+EXPORT_SYMBOL_GPL(device_add_groups);
void device_remove_groups(struct device *dev,
const struct attribute_group **groups)
{
sysfs_remove_groups(&dev->kobj, groups);
}
+EXPORT_SYMBOL_GPL(device_remove_groups);
static int device_add_attrs(struct device *dev)
{
diff --git a/include/linux/device.h b/include/linux/device.h
index 9ef518af5515..10cf209a4e82 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -1200,6 +1200,11 @@ struct device *device_create_with_groups(struct class *cls,
const char *fmt, ...);
extern void device_destroy(struct class *cls, dev_t devt);
+extern int __must_check device_add_groups(struct device *dev,
+ const struct attribute_group **groups);
+extern void device_remove_groups(struct device *dev,
+ const struct attribute_group **groups);
+
/*
* Platform "fixup" functions - allow the platform to have their say
* about devices and actions that the general device layer doesn't
--
2.14.0.rc0.284.gd933b75aa4-goog
next prev parent reply other threads:[~2017-07-20 0:24 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-20 0:24 [PATCH v2 0/7] New bind/unbingd uevents Dmitry Torokhov
2017-07-20 0:24 ` [PATCH v2 1/7] driver core: emit uevents when device is bound to a driver Dmitry Torokhov
2017-09-29 19:36 ` Dan Williams
2017-09-29 19:40 ` Ruhl, Michael J
2017-09-29 23:23 ` Dmitry Torokhov
2017-09-30 8:13 ` Greg Kroah-Hartman
2017-07-20 0:24 ` Dmitry Torokhov [this message]
2017-07-20 0:24 ` [PATCH v2 3/7] driver core: add device_{add|remove}_group() helpers Dmitry Torokhov
2017-07-20 0:24 ` [PATCH v2 4/7] driver core: add devm_device_add_group() and friends Dmitry Torokhov
2017-07-20 5:10 ` Greg Kroah-Hartman
2017-07-20 8:12 ` Dmitry Torokhov
2017-07-20 8:20 ` Greg Kroah-Hartman
2017-07-20 15:50 ` Dmitry Torokhov
2017-07-22 10:03 ` Greg Kroah-Hartman
2017-07-20 0:24 ` [PATCH v2 5/7] Input: gpio_keys - use devm_device_add_group() for attributes Dmitry Torokhov
2017-07-20 3:22 ` Guenter Roeck
2017-07-20 0:24 ` [PATCH v2 6/7] Input: synaptics_rmi4 - use devm_device_add_group() for attributes in F01 Dmitry Torokhov
2017-07-20 3:22 ` Guenter Roeck
2017-07-20 0:24 ` [PATCH v2 7/7] Input: axp20x-pek - switch to using devm_device_add_group() Dmitry Torokhov
2017-07-20 3:21 ` Guenter Roeck
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=20170720002436.29309-3-dmitry.torokhov@gmail.com \
--to=dmitry.torokhov@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=htejun@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@roeck-us.net \
/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
Powered by JetHome