netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] rtl8192e: Don't copy huge struct by value (and make it const).
@ 2011-11-06 23:21 Jesper Juhl
  2011-11-07 16:55 ` Larry Finger
  0 siblings, 1 reply; 2+ messages in thread
From: Jesper Juhl @ 2011-11-06 23:21 UTC (permalink / raw)
  To: devel, linux-kernel
  Cc: Andrea Merello, Mike McCormack, Larry Finger, Greg Kroah-Hartman, netdev

rtllib_is_shortslot() takes one argument - a struct that's more than a
kilobyte large. It should take a pointer instead of copying such a
huge struct - and the argument might as well be declared 'const' now
that we are at it, since it is not modified. This patch makes these
changes.

Signed-off-by: Jesper Juhl <jj@chaosbits.net>
---
 drivers/staging/rtl8192e/rtllib.h         |    2 +-
 drivers/staging/rtl8192e/rtllib_softmac.c |    4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/rtl8192e/rtllib.h b/drivers/staging/rtl8192e/rtllib.h
index de25975..3a52120 100644
--- a/drivers/staging/rtl8192e/rtllib.h
+++ b/drivers/staging/rtl8192e/rtllib.h
@@ -2804,7 +2804,7 @@ extern int rtllib_wx_set_gen_ie(struct rtllib_device *ieee, u8 *ie, size_t len);
 
 /* rtllib_softmac.c */
 extern short rtllib_is_54g(struct rtllib_network *net);
-extern short rtllib_is_shortslot(struct rtllib_network net);
+extern short rtllib_is_shortslot(const struct rtllib_network *net);
 extern int rtllib_rx_frame_softmac(struct rtllib_device *ieee,
 				   struct sk_buff *skb,
 				   struct rtllib_rx_stats *rx_stats, u16 type,
diff --git a/drivers/staging/rtl8192e/rtllib_softmac.c b/drivers/staging/rtl8192e/rtllib_softmac.c
index b508685..fa774cf 100644
--- a/drivers/staging/rtl8192e/rtllib_softmac.c
+++ b/drivers/staging/rtl8192e/rtllib_softmac.c
@@ -28,9 +28,9 @@ short rtllib_is_54g(struct rtllib_network *net)
 	return (net->rates_ex_len > 0) || (net->rates_len > 4);
 }
 
-short rtllib_is_shortslot(struct rtllib_network net)
+short rtllib_is_shortslot(const struct rtllib_network *net)
 {
-	return net.capability & WLAN_CAPABILITY_SHORT_SLOT_TIME;
+	return net->capability & WLAN_CAPABILITY_SHORT_SLOT_TIME;
 }
 
 /* returns the total length needed for pleacing the RATE MFIE
-- 
1.7.7.2


-- 
Jesper Juhl <jj@chaosbits.net>       http://www.chaosbits.net/
Don't top-post http://www.catb.org/jargon/html/T/top-post.html
Plain text mails only, please.

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

* Re: [PATCH] rtl8192e: Don't copy huge struct by value (and make it const).
  2011-11-06 23:21 [PATCH] rtl8192e: Don't copy huge struct by value (and make it const) Jesper Juhl
@ 2011-11-07 16:55 ` Larry Finger
  0 siblings, 0 replies; 2+ messages in thread
From: Larry Finger @ 2011-11-07 16:55 UTC (permalink / raw)
  To: Jesper Juhl
  Cc: devel, linux-kernel, Andrea Merello, Mike McCormack,
	Greg Kroah-Hartman, netdev

On 11/06/2011 05:21 PM, Jesper Juhl wrote:
> rtllib_is_shortslot() takes one argument - a struct that's more than a
> kilobyte large. It should take a pointer instead of copying such a
> huge struct - and the argument might as well be declared 'const' now
> that we are at it, since it is not modified. This patch makes these
> changes.
>
> Signed-off-by: Jesper Juhl<jj@chaosbits.net>

Acked-by: Larry Finger <Larry.Finger@lwfinger.net>

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

end of thread, other threads:[~2011-11-07 16:55 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-11-06 23:21 [PATCH] rtl8192e: Don't copy huge struct by value (and make it const) Jesper Juhl
2011-11-07 16:55 ` Larry Finger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).