[PATCH v2 13/14] staging: most: configfs: rename config attributes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This patch introduces attribute names that are more self explaining.

Signed-off-by: Christian Gromm <christian.gromm@xxxxxxxxxxxxx>
---
v2:
	- follow-up adaptions due to changes introduced w/ [PATCH v2 01/14]

 drivers/staging/most/configfs.c | 97 +++++++++++++++++++++--------------------
 1 file changed, 49 insertions(+), 48 deletions(-)

diff --git a/drivers/staging/most/configfs.c b/drivers/staging/most/configfs.c
index 1a5d6f8..546b658 100644
--- a/drivers/staging/most/configfs.c
+++ b/drivers/staging/most/configfs.c
@@ -15,8 +15,8 @@
 struct mdev_link {
 	struct config_item item;
 	struct list_head list;
-	bool create;
-	bool destroy;
+	bool create_link;
+	bool destroy_link;
 	u16 num_buffers;
 	u16 buffer_size;
 	u16 subbuffer_size;
@@ -25,10 +25,10 @@ struct mdev_link {
 	char datatype[PAGE_SIZE];
 	char direction[PAGE_SIZE];
 	char name[PAGE_SIZE];
-	char mdev[PAGE_SIZE];
+	char device[PAGE_SIZE];
 	char channel[PAGE_SIZE];
 	char comp[PAGE_SIZE];
-	char param[PAGE_SIZE];
+	char comp_params[PAGE_SIZE];
 };
 
 struct list_head mdev_link_list;
@@ -37,7 +37,7 @@ static int set_cfg_buffer_size(struct mdev_link *link)
 {
 	if (!link->buffer_size)
 		return -ENODATA;
-	return most_set_cfg_buffer_size(link->mdev, link->channel,
+	return most_set_cfg_buffer_size(link->device, link->channel,
 					link->buffer_size);
 }
 
@@ -45,7 +45,7 @@ static int set_cfg_subbuffer_size(struct mdev_link *link)
 {
 	if (!link->subbuffer_size)
 		return -ENODATA;
-	return most_set_cfg_subbuffer_size(link->mdev, link->channel,
+	return most_set_cfg_subbuffer_size(link->device, link->channel,
 					   link->subbuffer_size);
 }
 
@@ -53,7 +53,7 @@ static int set_cfg_dbr_size(struct mdev_link *link)
 {
 	if (!link->dbr_size)
 		return -ENODATA;
-	return most_set_cfg_dbr_size(link->mdev, link->channel,
+	return most_set_cfg_dbr_size(link->device, link->channel,
 				     link->dbr_size);
 }
 
@@ -61,7 +61,7 @@ static int set_cfg_num_buffers(struct mdev_link *link)
 {
 	if (!link->num_buffers)
 		return -ENODATA;
-	return most_set_cfg_num_buffers(link->mdev, link->channel,
+	return most_set_cfg_num_buffers(link->device, link->channel,
 					link->num_buffers);
 }
 
@@ -69,7 +69,7 @@ static int set_cfg_packets_xact(struct mdev_link *link)
 {
 	if (!link->packets_per_xact)
 		return -ENODATA;
-	return most_set_cfg_packets_xact(link->mdev, link->channel,
+	return most_set_cfg_packets_xact(link->device, link->channel,
 					 link->packets_per_xact);
 }
 
@@ -77,7 +77,7 @@ static int set_cfg_direction(struct mdev_link *link)
 {
 	if (!strlen(link->direction))
 		return -ENODATA;
-	return most_set_cfg_direction(link->mdev, link->channel,
+	return most_set_cfg_direction(link->device, link->channel,
 				      link->direction);
 }
 
@@ -85,7 +85,7 @@ static int set_cfg_datatype(struct mdev_link *link)
 {
 	if (!strlen(link->datatype))
 		return -ENODATA;
-	return most_set_cfg_datatype(link->mdev, link->channel,
+	return most_set_cfg_datatype(link->device, link->channel,
 				     link->datatype);
 }
 
@@ -117,13 +117,13 @@ static int set_config_and_add_link(struct mdev_link *mdev_link)
 		}
 	}
 
-	return most_add_link(mdev_link->mdev, mdev_link->channel,
+	return most_add_link(mdev_link->device, mdev_link->channel,
 			     mdev_link->comp, mdev_link->name,
-			     mdev_link->param);
+			     mdev_link->comp_params);
 }
 
-static ssize_t mdev_link_create_store(struct config_item *item,
-				      const char *page, size_t count)
+static ssize_t mdev_link_create_link_store(struct config_item *item,
+					   const char *page, size_t count)
 {
 	struct mdev_link *mdev_link = to_mdev_link(item);
 	bool tmp;
@@ -138,12 +138,12 @@ static ssize_t mdev_link_create_store(struct config_item *item,
 	if (ret && ret != -ENODEV)
 		return ret;
 	list_add_tail(&mdev_link->list, &mdev_link_list);
-	mdev_link->create = tmp;
+	mdev_link->create_link = tmp;
 	return count;
 }
 
-static ssize_t mdev_link_destroy_store(struct config_item *item,
-				       const char *page, size_t count)
+static ssize_t mdev_link_destroy_link_store(struct config_item *item,
+					    const char *page, size_t count)
 {
 	struct mdev_link *mdev_link = to_mdev_link(item);
 	bool tmp;
@@ -154,8 +154,8 @@ static ssize_t mdev_link_destroy_store(struct config_item *item,
 		return ret;
 	if (!tmp)
 		return count;
-	mdev_link->destroy = tmp;
-	ret = most_remove_link(mdev_link->mdev, mdev_link->channel,
+	mdev_link->destroy_link = tmp;
+	ret = most_remove_link(mdev_link->device, mdev_link->channel,
 			       mdev_link->comp);
 	if (ret)
 		return ret;
@@ -199,17 +199,17 @@ static ssize_t mdev_link_datatype_store(struct config_item *item,
 	return count;
 }
 
-static ssize_t mdev_link_mdev_show(struct config_item *item, char *page)
+static ssize_t mdev_link_device_show(struct config_item *item, char *page)
 {
-	return snprintf(page, PAGE_SIZE, "%s\n", to_mdev_link(item)->mdev);
+	return snprintf(page, PAGE_SIZE, "%s\n", to_mdev_link(item)->device);
 }
 
-static ssize_t mdev_link_mdev_store(struct config_item *item,
-				    const char *page, size_t count)
+static ssize_t mdev_link_device_store(struct config_item *item,
+				      const char *page, size_t count)
 {
 	struct mdev_link *mdev_link = to_mdev_link(item);
 
-	strcpy(mdev_link->mdev, page);
+	strcpy(mdev_link->device, page);
 	return count;
 }
 
@@ -241,17 +241,18 @@ static ssize_t mdev_link_comp_store(struct config_item *item,
 	return count;
 }
 
-static ssize_t mdev_link_param_show(struct config_item *item, char *page)
+static ssize_t mdev_link_comp_params_show(struct config_item *item, char *page)
 {
-	return snprintf(page, PAGE_SIZE, "%s\n", to_mdev_link(item)->param);
+	return snprintf(page, PAGE_SIZE, "%s\n",
+			to_mdev_link(item)->comp_params);
 }
 
-static ssize_t mdev_link_param_store(struct config_item *item,
-				     const char *page, size_t count)
+static ssize_t mdev_link_comp_params_store(struct config_item *item,
+					   const char *page, size_t count)
 {
 	struct mdev_link *mdev_link = to_mdev_link(item);
 
-	strcpy(mdev_link->param, page);
+	strcpy(mdev_link->comp_params, page);
 	return count;
 }
 
@@ -346,12 +347,12 @@ static ssize_t mdev_link_dbr_size_store(struct config_item *item,
 	return count;
 }
 
-CONFIGFS_ATTR_WO(mdev_link_, create);
-CONFIGFS_ATTR_WO(mdev_link_, destroy);
-CONFIGFS_ATTR(mdev_link_, mdev);
+CONFIGFS_ATTR_WO(mdev_link_, create_link);
+CONFIGFS_ATTR_WO(mdev_link_, destroy_link);
+CONFIGFS_ATTR(mdev_link_, device);
 CONFIGFS_ATTR(mdev_link_, channel);
 CONFIGFS_ATTR(mdev_link_, comp);
-CONFIGFS_ATTR(mdev_link_, param);
+CONFIGFS_ATTR(mdev_link_, comp_params);
 CONFIGFS_ATTR(mdev_link_, num_buffers);
 CONFIGFS_ATTR(mdev_link_, buffer_size);
 CONFIGFS_ATTR(mdev_link_, subbuffer_size);
@@ -361,12 +362,12 @@ CONFIGFS_ATTR(mdev_link_, direction);
 CONFIGFS_ATTR(mdev_link_, dbr_size);
 
 static struct configfs_attribute *mdev_link_attrs[] = {
-	&mdev_link_attr_create,
-	&mdev_link_attr_destroy,
-	&mdev_link_attr_mdev,
+	&mdev_link_attr_create_link,
+	&mdev_link_attr_destroy_link,
+	&mdev_link_attr_device,
 	&mdev_link_attr_channel,
 	&mdev_link_attr_comp,
-	&mdev_link_attr_param,
+	&mdev_link_attr_comp_params,
 	&mdev_link_attr_num_buffers,
 	&mdev_link_attr_buffer_size,
 	&mdev_link_attr_subbuffer_size,
@@ -383,7 +384,7 @@ static void mdev_link_release(struct config_item *item)
 	int ret;
 
 	if (!list_empty(&mdev_link_list)) {
-		ret = most_remove_link(mdev_link->mdev, mdev_link->channel,
+		ret = most_remove_link(mdev_link->device, mdev_link->channel,
 				       mdev_link->comp);
 		if (ret && (ret != -ENODEV))
 			pr_err("Removing link failed.\n");
@@ -481,7 +482,7 @@ static struct configfs_subsystem most_video_subsys = {
 
 struct most_snd_grp {
 	struct config_group group;
-	bool create;
+	bool create_card;
 	struct list_head list;
 };
 
@@ -500,14 +501,14 @@ static struct config_item *most_snd_grp_make_item(struct config_group *group,
 		return ERR_PTR(-ENOMEM);
 
 	config_item_init_type_name(&mdev_link->item, name, &mdev_link_type);
-	mdev_link->create = 0;
+	mdev_link->create_link = 0;
 	strcpy(mdev_link->name, name);
 	strcpy(mdev_link->comp, "sound");
 	return &mdev_link->item;
 }
 
-static ssize_t most_snd_grp_create_store(struct config_item *item,
-					 const char *page, size_t count)
+static ssize_t most_snd_grp_create_card_store(struct config_item *item,
+					      const char *page, size_t count)
 {
 	struct most_snd_grp *snd_grp = to_most_snd_grp(item);
 	int ret;
@@ -521,14 +522,14 @@ static ssize_t most_snd_grp_create_store(struct config_item *item,
 		if (ret)
 			return ret;
 	}
-	snd_grp->create = tmp;
+	snd_grp->create_card = tmp;
 	return count;
 }
 
-CONFIGFS_ATTR_WO(most_snd_grp_, create);
+CONFIGFS_ATTR_WO(most_snd_grp_, create_card);
 
 static struct configfs_attribute *most_snd_grp_attrs[] = {
-	&most_snd_grp_attr_create,
+	&most_snd_grp_attr_create_card,
 	NULL,
 };
 
@@ -568,7 +569,7 @@ static struct config_group *most_sound_make_group(struct config_group *group,
 					     struct most_sound, subsys);
 
 	list_for_each_entry(most, &ms->soundcard_list, list) {
-		if (!most->create) {
+		if (!most->create_card) {
 			pr_info("adapter configuration still in progress.\n");
 			return ERR_PTR(-EPROTO);
 		}
@@ -631,7 +632,7 @@ void most_interface_register_notify(const char *mdev)
 	struct mdev_link *mdev_link;
 
 	list_for_each_entry(mdev_link, &mdev_link_list, list) {
-		if (!strcmp(mdev_link->mdev, mdev)) {
+		if (!strcmp(mdev_link->device, mdev)) {
 			set_config_and_add_link(mdev_link);
 			if (!strcmp(mdev_link->comp, "sound"))
 				register_snd_card = true;
-- 
2.7.4

_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel



[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux