All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Randy.Dunlap" <rddunlap@osdl.org>
To: james4765@verizon.net
Cc: linux-kernel@vger.kernel.org, akpm@osdl.org
Subject: Re: [PATCH] ip2: fix compile warnings
Date: Fri, 17 Dec 2004 17:46:08 -0800	[thread overview]
Message-ID: <41C38BE0.30004@osdl.org> (raw)
In-Reply-To: <20041217214735.7127.91238.40236@localhost.localdomain>

james4765@verizon.net wrote:
> This fixes the following compile errors in the ip2 and ip2main drivers:
> 
>   CC      drivers/char/ip2main.o
> drivers/char/ip2main.c:470: warning: initialization from incompatible pointer type


> diff -urN --exclude='*~' linux-2.6.10-rc3-mm1-original/drivers/char/ip2main.c linux-2.6.10-rc3-mm1/drivers/char/ip2main.c
> --- linux-2.6.10-rc3-mm1-original/drivers/char/ip2main.c	2004-12-03 16:55:03.000000000 -0500
> +++ linux-2.6.10-rc3-mm1/drivers/char/ip2main.c	2004-12-17 16:24:24.094730049 -0500
> @@ -467,7 +466,7 @@
>  static struct tty_operations ip2_ops = {
>  	.open            = ip2_open,
>  	.close           = ip2_close,
> -	.write           = ip2_write,
> +	.write           = (void *) ip2_write,
>  	.put_char        = ip2_putchar,
>  	.flush_chars     = ip2_flush_chars,
>  	.write_room      = ip2_write_room,

The write() prototype in tty_operations is:
	int  (*write)(struct tty_struct * tty,
		      const unsigned char *buf, int count);

Somehow the cast does eliminate the compiler warning (and give
a false sense of correctness).

However, ip2main.c::ip2_write() should be modified like so:

static int
ip2_write( PTTY tty, const unsigned char *pData, int count)

and drop the cast and fix the ip2_write comment (drop old arg 2),
and fix the ip2_write() prototype.
But then you (someone) will have to decide how to handle the
dropped <user> parameter when calling i2Output()...
I don't know the answer to that.
I just changed <user> to 0 to get a clean build of ip2main.o,
but ip2/i2lib.c still needs some work.

-- 
~Randy

  reply	other threads:[~2004-12-18  1:50 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-12-17 21:47 [PATCH] ip2: fix compile warnings james4765
2004-12-18  1:46 ` Randy.Dunlap [this message]
2004-12-18 13:17   ` Jim Nelson
2004-12-20  6:20     ` Randy.Dunlap
2004-12-18  2:14 ` Adrian Bunk
2004-12-18  3:16   ` Jim Nelson
2004-12-19 14:08     ` Adrian Bunk

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=41C38BE0.30004@osdl.org \
    --to=rddunlap@osdl.org \
    --cc=akpm@osdl.org \
    --cc=james4765@verizon.net \
    --cc=linux-kernel@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.