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

Jeff Garzik (jgarzik@mandrakesoft.com)
Wed, 18 Sep 2002 12:39:03 -0400


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

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/