All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: [PATCH] rt2x00: Fix compile warning
  2008-08-02  5:49 [PATCH] rt2x00: Fix compile warning Ivo van Doorn
@ 2008-08-02  5:30 ` David Miller
  2008-08-02  6:11   ` Ivo van Doorn
  0 siblings, 1 reply; 4+ messages in thread
From: David Miller @ 2008-08-02  5:30 UTC (permalink / raw)
  To: ivdoorn; +Cc: linville, linux-wireless, rt2400-devel

From: Ivo van Doorn <ivdoorn@gmail.com>
Date: Sat, 2 Aug 2008 07:49:08 +0200

> rt2x00usb_vendor_request_large_buff is write-only, so it is
> safe to make the argument a const.
> 
> Fixes compile warning:
> drivers/net/wireless/rt2x00/rt73usb.c: In function 'rt73usb_load_firmware':
> drivers/net/wireless/rt2x00/rt73usb.c:916: warning: passing argument 5 of 'rt2x00usb_vendor_request_large_buff' discards qualifiers from pointer target typ
> 
> Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>

Are you sure?

This buffer pointer, via 'tb', eventually gets passed down
to rt2x00usb_vendor_req_buff_lock which conditionally copies
into the buffer.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH] rt2x00: Fix compile warning
@ 2008-08-02  5:49 Ivo van Doorn
  2008-08-02  5:30 ` David Miller
  0 siblings, 1 reply; 4+ messages in thread
From: Ivo van Doorn @ 2008-08-02  5:49 UTC (permalink / raw)
  To: David Miller; +Cc: linville, linux-wireless, rt2400-devel

rt2x00usb_vendor_request_large_buff is write-only, so it is
safe to make the argument a const.

Fixes compile warning:
drivers/net/wireless/rt2x00/rt73usb.c: In function 'rt73usb_load_firmware':
drivers/net/wireless/rt2x00/rt73usb.c:916: warning: passing argument 5 of 'rt2x00usb_vendor_request_large_buff' discards qualifiers from pointer target typ

Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
---
 drivers/net/wireless/rt2x00/rt2x00usb.c |    4 ++--
 drivers/net/wireless/rt2x00/rt2x00usb.h |    2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/net/wireless/rt2x00/rt2x00usb.c b/drivers/net/wireless/rt2x00/rt2x00usb.c
index 933e6cc..8d76bb2 100644
--- a/drivers/net/wireless/rt2x00/rt2x00usb.c
+++ b/drivers/net/wireless/rt2x00/rt2x00usb.c
@@ -124,7 +124,7 @@ EXPORT_SYMBOL_GPL(rt2x00usb_vendor_request_buff);
 
 int rt2x00usb_vendor_request_large_buff(struct rt2x00_dev *rt2x00dev,
 					const u8 request, const u8 requesttype,
-					const u16 offset, void *buffer,
+					const u16 offset, const void *buffer,
 					const u16 buffer_length,
 					const int timeout)
 {
@@ -134,7 +134,7 @@ int rt2x00usb_vendor_request_large_buff(struct rt2x00_dev *rt2x00dev,
 
 	mutex_lock(&rt2x00dev->usb_cache_mutex);
 
-	tb  = buffer;
+	tb  = (char *)buffer;
 	off = offset;
 	len = buffer_length;
 	while (len && !status) {
diff --git a/drivers/net/wireless/rt2x00/rt2x00usb.h b/drivers/net/wireless/rt2x00/rt2x00usb.h
index ee3875f..3b4a674 100644
--- a/drivers/net/wireless/rt2x00/rt2x00usb.h
+++ b/drivers/net/wireless/rt2x00/rt2x00usb.h
@@ -185,7 +185,7 @@ int rt2x00usb_vendor_req_buff_lock(struct rt2x00_dev *rt2x00dev,
  */
 int rt2x00usb_vendor_request_large_buff(struct rt2x00_dev *rt2x00dev,
 					const u8 request, const u8 requesttype,
-					const u16 offset, void *buffer,
+					const u16 offset, const void *buffer,
 					const u16 buffer_length,
 					const int timeout);
 
-- 
1.5.6.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] rt2x00: Fix compile warning
  2008-08-02  5:30 ` David Miller
@ 2008-08-02  6:11   ` Ivo van Doorn
  2008-08-02  8:31     ` David Miller
  0 siblings, 1 reply; 4+ messages in thread
From: Ivo van Doorn @ 2008-08-02  6:11 UTC (permalink / raw)
  To: David Miller; +Cc: linville, linux-wireless, rt2400-devel

On Saturday 02 August 2008, David Miller wrote:
> From: Ivo van Doorn <ivdoorn@gmail.com>
> Date: Sat, 2 Aug 2008 07:49:08 +0200
> 
> > rt2x00usb_vendor_request_large_buff is write-only, so it is
> > safe to make the argument a const.
> > 
> > Fixes compile warning:
> > drivers/net/wireless/rt2x00/rt73usb.c: In function 'rt73usb_load_firmware':
> > drivers/net/wireless/rt2x00/rt73usb.c:916: warning: passing argument 5 of 'rt2x00usb_vendor_request_large_buff' discards qualifiers from pointer target typ
> > 
> > Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
> 
> Are you sure?
> 
> This buffer pointer, via 'tb', eventually gets passed down
> to rt2x00usb_vendor_req_buff_lock which conditionally copies
> into the buffer.

Yes but rt2x00usb_vendor_req_buff_lock() can't use the const buffer since
it calls:
	memcpy(buffer, rt2x00dev->csr.cache, buffer_length);
and rt2x00usb_vendor_req_buff_lock() is valid for read commands.

Only rt2x00usb_vendor_request_large_buff() is write only, so that sounds like
the most sane place to convert the const pointer to the normal pointer.

Ivo

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] rt2x00: Fix compile warning
  2008-08-02  6:11   ` Ivo van Doorn
@ 2008-08-02  8:31     ` David Miller
  0 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2008-08-02  8:31 UTC (permalink / raw)
  To: ivdoorn; +Cc: linville, linux-wireless, rt2400-devel

From: Ivo van Doorn <ivdoorn@gmail.com>
Date: Sat, 2 Aug 2008 08:11:35 +0200

> Yes but rt2x00usb_vendor_req_buff_lock() can't use the const buffer since
> it calls:
> 	memcpy(buffer, rt2x00dev->csr.cache, buffer_length);
> and rt2x00usb_vendor_req_buff_lock() is valid for read commands.
> 
> Only rt2x00usb_vendor_request_large_buff() is write only, so that sounds like
> the most sane place to convert the const pointer to the normal pointer.

Ok, I see.  Patch applied, thanks!

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2008-08-02  8:31 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-08-02  5:49 [PATCH] rt2x00: Fix compile warning Ivo van Doorn
2008-08-02  5:30 ` David Miller
2008-08-02  6:11   ` Ivo van Doorn
2008-08-02  8:31     ` David Miller

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.