2002-09-18 05:58:16

by Albert Cranford

[permalink] [raw]
Subject: [patch 1/3] 2.5.36 i2c core drivers module_init/exit cleanup

Hello Linus,
Cleanup of i2c-core, i2c-proc and i2c-dev to use new module_init and module_exit
functions. Cleanup of old compatability statements.
Albert
--
[email protected]


Attachments:
1-mod-cleanup-patch (10.91 kB)

2002-09-18 16:36:31

by Jeff Garzik

[permalink] [raw]
Subject: Re: [patch 1/3] 2.5.36 i2c core drivers module_init/exit cleanup

Albert Cranford wrote:
> /**** debug level */
> -static int i2c_debug=1;
> +static int i2c_debug=0;

don't need "=0", that wastes space in initialized data section


> @@ -658,18 +624,19 @@
> struct i2c_client *client;
> int i,j,k,order_nr,len=0,len_total;
> int order[I2C_CLIENT_MAX];
> +#define OUTPUT_LENGTH_PER_LINE 70
>
> - if (count > 4096)
> - return -EINVAL;
> len_total = file->f_pos + count;
> - /* Too bad if this gets longer (unlikely) */
> - if (len_total > 4096)
> - len_total = 4096;
> + if (len_total > (I2C_CLIENT_MAX * OUTPUT_LENGTH_PER_LINE) )
> + /* adjust to maximum file size */
> + len_total = (I2C_CLIENT_MAX * OUTPUT_LENGTH_PER_LINE);
> for (i = 0; i < I2C_ADAP_MAX; i++)
> if (adapters[i]->inode == inode->i_ino) {
> /* We need a bit of slack in the kernel buffer; this makes the
> sprintf safe. */
> - if (! (kbuf = kmalloc(count + 80,GFP_KERNEL)))
> + if (! (kbuf = kmalloc(len_total +
> + OUTPUT_LENGTH_PER_LINE,
> + GFP_KERNEL)))
> return -ENOMEM;
> /* Order will hold the indexes of the clients

this really wants to be converted to seq_printf API...

otherwise, looks ok