: Added CONFIGFS_EATTR_OPS_RO() to remove unused store() function
PATCH 1/1 : Added CONFIGFS_EATTR_OPS_RO() to remove unused store() function
Hi again,
Added another change to the CONFIGFS_EATTR() macros I am using in drivers/lio-core/configfs_macros.h:
When using __CONFIGFS_ATTR_RO(), I noticed that CONFIGFS_ATTR_OPS() was getting the compiler warning about unused store() functions. So I ended up breaking out the 3 functions into three different macros..
Thanks!
--nab
Quoted 1 line
From
4cfb0287a2fc48bc414e3467edb8cdfc88c2fc72Mon Sep 17 00:00:00 2001
From: Nicholas Bellinger <[email protected]>
Date: Thu, 23 Oct 2008 06:56:29 -0700
Subject: [PATCH] [ConfigFS]: Added CONFIGFS_EATTR_OPS_RO() to remove unused store() function
Added CONFIGFS_EATTR_OPS_RO() macro only defines show(). This patch also breaks out the show()/store() and to_##_name() functions into their own macros.
--- drivers/lio-core/configfs_macros.h | 19 ++++++++++++++++--- 1 files changed, 16 insertions(+), 3 deletions(-)
drivers/lio-core/configfs_macros.h +16 -3
@@ -98,12 +98,14 @@ struct _name##_attribute { \* ^^_item^^^^^ ^^_item_member^^^ * This macro expects the attributes to be named "struct <name>_attribute". */ -#define CONFIGFS_EATTR_OPS (_name, _item, _item_member) \ +#define CONFIGFS_EATTR_OPS_TO_FUNC (_name, _item, _item_member) \ static struct _item *to_##_name(struct config_item *ci) \ { \ return((ci) ? container_of(to_config_group(ci), struct _item, \ _item_member) : NULL); \ -} \ +} + +#define CONFIGFS_EATTR_OPS_SHOW (_name, _item) \ static ssize_t _name##_attr_show(struct config_item *item, \ struct configfs_attribute *attr, \ char *page) \
@@ -116,7 +118,9 @@ static ssize_t _name##_attr_show(struct config_item *item, \ if (_name##_attr->show) \ ret = _name##_attr->show(_item, page); \return ret; \ -} \ +} + +#define CONFIGFS_EATTR_OPS_STORE (_name, _item) \ static ssize_t _name##_attr_store(struct config_item *item, \ struct configfs_attribute *attr, \ const char *page, size_t count) \
@@ -131,4 +135,13 @@ static ssize_t _name##_attr_store(struct config_item *item, \ return ret; \ } +#define CONFIGFS_EATTR_OPS (_name, _item, _item_member) \ +CONFIGFS_EATTR_OPS_TO_FUNC(_name, _item, _item_member); \ +CONFIGFS_EATTR_OPS_SHOW(_name, _item); \ +CONFIGFS_EATTR_OPS_STORE(_name, _item); + +#define CONFIGFS_EATTR_OPS_RO (_name, _item, _item_member) \ +CONFIGFS_EATTR_OPS_TO_FUNC(_name, _item, _item_member); \ +CONFIGFS_EATTR_OPS_SHOW(_name, _item); +#endif /* _CONFIGFS_MACROS_H_ */
Signature · 1 line
1.5.4.1