linux-i2c.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] i2c: mux: demux-pinctrl: Fix reading the "master" attribute
@ 2016-03-30 16:27 Ben Hutchings
  2016-03-30 16:42 ` [Linux-kernel] " Ben Dooks
  0 siblings, 1 reply; 4+ messages in thread
From: Ben Hutchings @ 2016-03-30 16:27 UTC (permalink / raw)
  To: Wolfram Sang; +Cc: linux-i2c, CT kernel

sysfs attributes should use the same format for reads and writes,
rather than pretty-printing on read.

Fixes: 50a5ba876908 ("i2c: mux: demux-pinctrl: add driver")
Signed-off-by: Ben Hutchings <ben.hutchings@codethink.co.uk>
---
 drivers/i2c/muxes/i2c-demux-pinctrl.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/drivers/i2c/muxes/i2c-demux-pinctrl.c b/drivers/i2c/muxes/i2c-demux-pinctrl.c
index 7748a0a5ddb9..9e8f3d702314 100644
--- a/drivers/i2c/muxes/i2c-demux-pinctrl.c
+++ b/drivers/i2c/muxes/i2c-demux-pinctrl.c
@@ -144,14 +144,8 @@ static ssize_t cur_master_show(struct device *dev, struct device_attribute *attr
 			   char *buf)
 {
 	struct i2c_demux_pinctrl_priv *priv = dev_get_drvdata(dev);
-	int count = 0, i;
 
-	for (i = 0; i < priv->num_chan && count < PAGE_SIZE; i++)
-		count += scnprintf(buf + count, PAGE_SIZE - count, "%c %d - %s\n",
-				 i == priv->cur_chan ? '*' : ' ', i,
-				 priv->chan[i].parent_np->full_name);
-
-	return count;
+	return sprintf(buf, "%u\n", priv->cur_chan);
 }
 
 static ssize_t cur_master_store(struct device *dev, struct device_attribute *attr,

-- 
Ben Hutchings
Software Developer, Codethink Ltd.

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-03-30 20:56 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-30 16:27 [PATCH] i2c: mux: demux-pinctrl: Fix reading the "master" attribute Ben Hutchings
2016-03-30 16:42 ` [Linux-kernel] " Ben Dooks
2016-03-30 16:45   ` Ben Hutchings
2016-03-30 20:56     ` Wolfram Sang

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).