* [PATCH 1/4] [media] lmedm04: use %phN for hex dump
@ 2016-11-30 21:39 Rasmus Villemoes
2016-11-30 21:39 ` [PATCH 2/4] [media] lmedm04: change some static variables to automatic Rasmus Villemoes
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Rasmus Villemoes @ 2016-11-30 21:39 UTC (permalink / raw)
To: Malcolm Priestley, Mauro Carvalho Chehab
Cc: Rasmus Villemoes, linux-media, linux-kernel
Using the %ph printf extension for hex dumps like this makes the
generated code quite a bit smaller.
Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
---
drivers/media/usb/dvb-usb-v2/lmedm04.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/media/usb/dvb-usb-v2/lmedm04.c b/drivers/media/usb/dvb-usb-v2/lmedm04.c
index 0e8fb89896c4..7692701878ba 100644
--- a/drivers/media/usb/dvb-usb-v2/lmedm04.c
+++ b/drivers/media/usb/dvb-usb-v2/lmedm04.c
@@ -99,9 +99,7 @@ static int dvb_usb_lme2510_debug;
} while (0)
#define deb_info(level, args...) lme_debug(dvb_usb_lme2510_debug, level, args)
#define debug_data_snipet(level, name, p) \
- deb_info(level, name" (%02x%02x%02x%02x%02x%02x%02x%02x)", \
- *p, *(p+1), *(p+2), *(p+3), *(p+4), \
- *(p+5), *(p+6), *(p+7));
+ deb_info(level, name" (%8phN)", p);
#define info(args...) pr_info(DVB_USB_LOG_PREFIX": "args)
module_param_named(debug, dvb_usb_lme2510_debug, int, 0644);
--
2.1.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 2/4] [media] lmedm04: change some static variables to automatic
2016-11-30 21:39 [PATCH 1/4] [media] lmedm04: use %phN for hex dump Rasmus Villemoes
@ 2016-11-30 21:39 ` Rasmus Villemoes
2016-11-30 21:39 ` [PATCH 3/4] [media] lmedm04: make some string arrays static Rasmus Villemoes
2016-11-30 21:39 ` [PATCH 4/4] [media] lmedm04: make lme2510_powerup a little smaller Rasmus Villemoes
2 siblings, 0 replies; 4+ messages in thread
From: Rasmus Villemoes @ 2016-11-30 21:39 UTC (permalink / raw)
To: Malcolm Priestley, Mauro Carvalho Chehab
Cc: Rasmus Villemoes, linux-media, linux-kernel
ibuf and rbuf in lme2510_int_response are always assigned to before they
are read, and their addresses do not escape the function, so they have
no reason to be static.
Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
---
drivers/media/usb/dvb-usb-v2/lmedm04.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/media/usb/dvb-usb-v2/lmedm04.c b/drivers/media/usb/dvb-usb-v2/lmedm04.c
index 7692701878ba..cd463f09ebc7 100644
--- a/drivers/media/usb/dvb-usb-v2/lmedm04.c
+++ b/drivers/media/usb/dvb-usb-v2/lmedm04.c
@@ -315,7 +315,7 @@ static void lme2510_int_response(struct urb *lme_urb)
{
struct dvb_usb_adapter *adap = lme_urb->context;
struct lme2510_state *st = adap_to_priv(adap);
- static u8 *ibuf, *rbuf;
+ u8 *ibuf, *rbuf;
int i = 0, offset;
u32 key;
u8 signal_lock = 0;
--
2.1.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 3/4] [media] lmedm04: make some string arrays static
2016-11-30 21:39 [PATCH 1/4] [media] lmedm04: use %phN for hex dump Rasmus Villemoes
2016-11-30 21:39 ` [PATCH 2/4] [media] lmedm04: change some static variables to automatic Rasmus Villemoes
@ 2016-11-30 21:39 ` Rasmus Villemoes
2016-11-30 21:39 ` [PATCH 4/4] [media] lmedm04: make lme2510_powerup a little smaller Rasmus Villemoes
2 siblings, 0 replies; 4+ messages in thread
From: Rasmus Villemoes @ 2016-11-30 21:39 UTC (permalink / raw)
To: Malcolm Priestley, Mauro Carvalho Chehab
Cc: Rasmus Villemoes, linux-media, linux-kernel
It takes more .text to initialize these on the stack than they occupy
in .rodata, so just make them static const.
Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
---
drivers/media/usb/dvb-usb-v2/lmedm04.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/drivers/media/usb/dvb-usb-v2/lmedm04.c b/drivers/media/usb/dvb-usb-v2/lmedm04.c
index cd463f09ebc7..bf5bc36a6ed9 100644
--- a/drivers/media/usb/dvb-usb-v2/lmedm04.c
+++ b/drivers/media/usb/dvb-usb-v2/lmedm04.c
@@ -1002,8 +1002,9 @@ static int lme_name(struct dvb_usb_adapter *adap)
struct dvb_usb_device *d = adap_to_d(adap);
struct lme2510_state *st = adap_to_priv(adap);
const char *desc = d->name;
- char *fe_name[] = {"", " LG TDQY-P001F", " SHARP:BS2F7HZ7395",
- " SHARP:BS2F7HZ0194", " RS2000"};
+ static const char * const fe_name[] = {
+ "", " LG TDQY-P001F", " SHARP:BS2F7HZ7395",
+ " SHARP:BS2F7HZ0194", " RS2000"};
char *name = adap->fe[0]->ops.info.name;
strlcpy(name, desc, 128);
@@ -1124,7 +1125,7 @@ static int dm04_lme2510_tuner(struct dvb_usb_adapter *adap)
{
struct dvb_usb_device *d = adap_to_d(adap);
struct lme2510_state *st = adap_to_priv(adap);
- char *tun_msg[] = {"", "TDA8263", "IX2505V", "DVB_PLL_OPERA", "RS2000"};
+ static const char * const tun_msg[] = {"", "TDA8263", "IX2505V", "DVB_PLL_OPERA", "RS2000"};
int ret = 0;
switch (st->tuner_config) {
--
2.1.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 4/4] [media] lmedm04: make lme2510_powerup a little smaller
2016-11-30 21:39 [PATCH 1/4] [media] lmedm04: use %phN for hex dump Rasmus Villemoes
2016-11-30 21:39 ` [PATCH 2/4] [media] lmedm04: change some static variables to automatic Rasmus Villemoes
2016-11-30 21:39 ` [PATCH 3/4] [media] lmedm04: make some string arrays static Rasmus Villemoes
@ 2016-11-30 21:39 ` Rasmus Villemoes
2 siblings, 0 replies; 4+ messages in thread
From: Rasmus Villemoes @ 2016-11-30 21:39 UTC (permalink / raw)
To: Malcolm Priestley, Mauro Carvalho Chehab
Cc: Rasmus Villemoes, linux-media, linux-kernel
gcc isn't smart enough to realize it can share most of the argument
buildup and the actual function call between the two branches, so help
it a little.
Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
---
drivers/media/usb/dvb-usb-v2/lmedm04.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/drivers/media/usb/dvb-usb-v2/lmedm04.c b/drivers/media/usb/dvb-usb-v2/lmedm04.c
index bf5bc36a6ed9..7462207f4fd7 100644
--- a/drivers/media/usb/dvb-usb-v2/lmedm04.c
+++ b/drivers/media/usb/dvb-usb-v2/lmedm04.c
@@ -1179,10 +1179,7 @@ static int lme2510_powerup(struct dvb_usb_device *d, int onoff)
mutex_lock(&d->i2c_mutex);
- if (onoff)
- ret = lme2510_usb_talk(d, lnb_on, len, rbuf, rlen);
- else
- ret = lme2510_usb_talk(d, lnb_off, len, rbuf, rlen);
+ ret = lme2510_usb_talk(d, onoff ? lnb_on : lnb_off, len, rbuf, rlen);
st->i2c_talk_onoff = 1;
--
2.1.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2016-11-30 21:40 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-11-30 21:39 [PATCH 1/4] [media] lmedm04: use %phN for hex dump Rasmus Villemoes
2016-11-30 21:39 ` [PATCH 2/4] [media] lmedm04: change some static variables to automatic Rasmus Villemoes
2016-11-30 21:39 ` [PATCH 3/4] [media] lmedm04: make some string arrays static Rasmus Villemoes
2016-11-30 21:39 ` [PATCH 4/4] [media] lmedm04: make lme2510_powerup a little smaller Rasmus Villemoes
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).