[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <201703062148.36101.PeterHuewe@gmx.de>
Date: Mon, 6 Mar 2017 21:48:35 +0100
From: Peter Hüwe <PeterHuewe@....de>
To: linux-hwmon@...r.kernel.org, Guenter Roeck <linux@...ck-us.net>
Cc: Jean Delvare <jdelvare@...e.com>, linux-kernel@...r.kernel.org
Subject: Question about hwmon_attr_show_string
Hi Guenter,
I was wondering whether there was a particular reason why
hwmon_attr_show_string passes only an "empty" pointer(pointer) to the ops-
>read_string function rather than the buffer itself?
Wouldn't this mean that in ops->read_string I'd have to reserve some space for
the value on the heap (and taking care to free it somewhere, since returning
an address on the stack is bad idea), instead of calling sprintf(buf, "%s\n",
s) directly?
With the current implementation I have to sprintf it into my local buffer and
you sprintf it again into the final buffer.
Unfortunately there are no other callers, where you show the intended usage.
Thanks,
Peter
Powered by blists - more mailing lists