public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jeff Garzik <jgarzik@mandrakesoft.com>
To: Albert Cranford <ac9410@attbi.com>
Cc: Linus Torvalds <torvalds@transmeta.com>,
	Kernel mailing list <linux-kernel@vger.kernel.org>
Subject: Re: [patch 1/3] 2.5.36 i2c core drivers module_init/exit cleanup
Date: Wed, 18 Sep 2002 12:39:03 -0400	[thread overview]
Message-ID: <3D88AC27.4050805@mandrakesoft.com> (raw)
In-Reply-To: Pine.LNX.4.44.0209180158230.358-200000@home1

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


      reply	other threads:[~2002-09-18 16:36 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-09-18  6:03 [patch 1/3] 2.5.36 i2c core drivers module_init/exit cleanup Albert Cranford
2002-09-18 16:39 ` Jeff Garzik [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3D88AC27.4050805@mandrakesoft.com \
    --to=jgarzik@mandrakesoft.com \
    --cc=ac9410@attbi.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@transmeta.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox