Commit a6abfdff authored by Joe Perches's avatar Joe Perches Committed by Greg Kroah-Hartman

parport: Standardize use of printmode

Standardize the define and the uses of printmode.

Miscellanea:

o Add missing statement termination ; where necessary
Signed-off-by: default avatarJoe Perches <joe@perches.com>
Reviewed-by: default avatarRandy Dunlap <rdunlap@infradead.org>
Signed-off-by: default avatarSudip Mukherjee <sudipm.mukherjee@gmail.com>
Link: https://lore.kernel.org/r/20200403134325.11523-8-sudipm.mukherjee@gmail.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 7b399257
......@@ -299,12 +299,16 @@ struct parport *parport_gsc_probe_port(unsigned long base,
p->dma = PARPORT_DMA_NONE;
pr_cont(" [");
#define printmode(x) {if(p->modes&PARPORT_MODE_##x){pr_cont("%s%s",f?",":"",#x);f++;}}
#define printmode(x) \
do { \
if (p->modes & PARPORT_MODE_##x) \
pr_cont("%s%s", f++ ? "," : "", #x); \
} while (0)
{
int f = 0;
printmode(PCSPP);
printmode(TRISTATE);
printmode(COMPAT)
printmode(COMPAT);
printmode(EPP);
// printmode(ECP);
// printmode(DMA);
......
......@@ -2134,19 +2134,17 @@ struct parport *parport_pc_probe_port(unsigned long int base,
pr_cont(" [");
#define printmode(x) \
{\
if (p->modes & PARPORT_MODE_##x) {\
pr_cont("%s%s", f ? "," : "", #x); \
f++;\
} \
}
#define printmode(x) \
do { \
if (p->modes & PARPORT_MODE_##x) \
pr_cont("%s%s", f++ ? "," : "", #x); \
} while (0)
{
int f = 0;
printmode(PCSPP);
printmode(TRISTATE);
printmode(COMPAT)
printmode(COMPAT);
printmode(EPP);
printmode(ECP);
printmode(DMA);
......
......@@ -213,7 +213,11 @@ static int do_hardware_modes(struct ctl_table *table, int write,
return -EACCES;
{
#define printmode(x) {if(port->modes&PARPORT_MODE_##x){len+=sprintf(buffer+len,"%s%s",f?",":"",#x);f++;}}
#define printmode(x) \
do { \
if (port->modes & PARPORT_MODE_##x) \
len += sprintf(buffer + len, "%s%s", f++ ? "," : "", #x); \
} while (0)
int f = 0;
printmode(PCSPP);
printmode(TRISTATE);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment