* Const buffer pointers for SMBus/I2C block write functions
@ 2010-11-16 5:57 Roman Fietze
[not found] ` <201011160657.11061.roman.fietze-rVvtEhYSWBkAey3BTtE3dg@public.gmane.org>
0 siblings, 1 reply; 2+ messages in thread
From: Roman Fietze @ 2010-11-16 5:57 UTC (permalink / raw)
To: linux-i2c-u79uwXL29TY76Z2rM5mHXA
Hello List Members,
I was asked to post this patch here.
If the SMBus and I2C block write functions in i2c-dev.h (the version
from lm-sensors, not the kernel) would take const buffer pointers,
this would allow callers to use const data to be sent via SMB/I2C.
Please see the diff below.
Index: include/linux/i2c-dev.h
===================================================================
--- include/linux/i2c-dev.h (revision 5881)
+++ include/linux/i2c-dev.h (working copy)
@@ -258,7 +258,7 @@
}
static inline __s32 i2c_smbus_write_block_data(int file, __u8 command,
- __u8 length, __u8 *values)
+ __u8 length, const __u8 *values)
{
union i2c_smbus_data data;
int i;
@@ -296,7 +296,7 @@
}
static inline __s32 i2c_smbus_write_i2c_block_data(int file, __u8 command,
- __u8 length, __u8 *values)
+ __u8 length, const __u8 *values)
{
union i2c_smbus_data data;
int i;
Roman
--
Roman Fietze Telemotive AG Buero Muehlhausen
Breitwiesen 73347 Muehlhausen
Tel.: +49(0)7335/18493-45 http://www.telemotive.de
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Const buffer pointers for SMBus/I2C block write functions
[not found] ` <201011160657.11061.roman.fietze-rVvtEhYSWBkAey3BTtE3dg@public.gmane.org>
@ 2010-12-12 13:23 ` Jean Delvare
0 siblings, 0 replies; 2+ messages in thread
From: Jean Delvare @ 2010-12-12 13:23 UTC (permalink / raw)
To: Roman Fietze; +Cc: linux-i2c-u79uwXL29TY76Z2rM5mHXA
Hi Roman,
Sorry for the late answer.
On Tue, 16 Nov 2010 06:57:10 +0100, Roman Fietze wrote:
> If the SMBus and I2C block write functions in i2c-dev.h (the version
> from lm-sensors, not the kernel) would take const buffer pointers,
> this would allow callers to use const data to be sent via SMB/I2C.
The lm-sensors package no longer includes the "user-space version" of
i2c-dev. It is part of i2c-tools now.
Note that this file is an horror, BTW. It should be turned into a proper
library, to avoid the confusion with the kernel header file. This is on
my to-do list for year 2011.
> Please see the diff below.
>
>
> Index: include/linux/i2c-dev.h
> ===================================================================
> --- include/linux/i2c-dev.h (revision 5881)
> +++ include/linux/i2c-dev.h (working copy)
> @@ -258,7 +258,7 @@
> }
>
> static inline __s32 i2c_smbus_write_block_data(int file, __u8 command,
> - __u8 length, __u8 *values)
> + __u8 length, const __u8 *values)
> {
> union i2c_smbus_data data;
> int i;
> @@ -296,7 +296,7 @@
> }
>
> static inline __s32 i2c_smbus_write_i2c_block_data(int file, __u8 command,
> - __u8 length, __u8 *values)
> + __u8 length, const __u8 *values)
> {
> union i2c_smbus_data data;
> int i;
>
Yes, this makes sense. Patch applied, thanks.
--
Jean Delvare
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2010-12-12 13:23 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-11-16 5:57 Const buffer pointers for SMBus/I2C block write functions Roman Fietze
[not found] ` <201011160657.11061.roman.fietze-rVvtEhYSWBkAey3BTtE3dg@public.gmane.org>
2010-12-12 13:23 ` Jean Delvare
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).