Dead code in i2c

Philip Pokorny ppokorny at penguincomputing.com
Tue Jun 3 03:49:37 CEST 2003


Ahh, but didn't Kyosti or Greg delete all the command functions from all 
the chip driver modules?

I think that all the drivers had "command" functions that said "None at 
this time", but removing that code was one of the things I had to do to 
make my 2.7.0 driver "cvs"...  So I don't think any of drivers even have 
a command function any more.

Which is not an argument for removing the function to access them, but 
it seems odd that it would be an inline function in that case...

:v)

Mark D. Studebaker wrote:
> This was not in 2.7.0.
> Kyosti put it in before the branch so it's in both branches.
> Nothing in our trees use the driver->command function but it may be 
> worthwhile in
> the future. Adding an inline function to make it more accessible is fine 
> too.
> How about just adding #include <linux/errno.h> to i2c.h?
> 
> Philip Pokorny wrote:
> 
>> I'm trying to compile i2c-cvs on a Red Hat beta kernel.
>>
>> I'm getting an error due to EINVAL not being defined.  But the 
>> reference to EINVAL is in a function that apears to be dead code.  The 
>> function is not referenced in any other i2c or lm_sensors files...
>>
>> The following patch removes the offending function...
>>
>> Index: kernel/i2c.h
>> ===================================================================
>> RCS file: /home/cvs/i2c/kernel/i2c.h,v
>> retrieving revision 1.68
>> diff -u -r1.68 i2c.h
>> --- kernel/i2c.h    21 Jan 2003 08:08:16 -0000    1.68
>> +++ kernel/i2c.h    2 Jun 2003 06:21:27 -0000
>> @@ -318,15 +318,6 @@
>>          struct i2c_client_address_data *address_data,
>>          i2c_client_found_addr_proc *found_proc);
>>
>> -static inline int i2c_client_command(struct i2c_client *client,
>> -                  unsigned int cmd, void *arg)
>> -{
>> - if (client->driver && client->driver->command)
>> -     return client->driver->command(client, cmd, arg);
>> - else
>> -     return -EINVAL;
>> -}
>> -
>>  /* An ioctl like call to set div. parameters of the adapter.
>>   */
>>  extern int i2c_control(struct i2c_client *,unsigned int, unsigned long);
>>
> 



-- 
Philip Pokorny, Director of Engineering
Tel: 415-358-2635   Fax: 415-358-2646   Toll Free: 888-PENGUIN
PENGUIN COMPUTING, INC.
www.penguincomputing.com



More information about the lm-sensors mailing list