Skip to content

Commit

Permalink
parport: Standardize use of printmode
Browse files Browse the repository at this point in the history
Standardize the define and the uses of printmode.

Miscellanea:

o Add missing statement termination ; where necessary

Signed-off-by: Joe Perches <[email protected]>
Reviewed-by: Randy Dunlap <[email protected]>
Signed-off-by: Sudip Mukherjee <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Greg Kroah-Hartman <[email protected]>
  • Loading branch information
JoePerches authored and gregkh committed Apr 23, 2020
1 parent 7b39925 commit a6abfdf
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 11 deletions.
8 changes: 6 additions & 2 deletions drivers/parport/parport_gsc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
14 changes: 6 additions & 8 deletions drivers/parport/parport_pc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
6 changes: 5 additions & 1 deletion drivers/parport/procfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit a6abfdf

Please sign in to comment.