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

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.com


Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 7b399257
Loading
Loading
Loading
Loading
+6 −2
Original line number Original line Diff line number Diff line
@@ -299,12 +299,16 @@ struct parport *parport_gsc_probe_port(unsigned long base,
		p->dma = PARPORT_DMA_NONE;
		p->dma = PARPORT_DMA_NONE;


	pr_cont(" [");
	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;
		int f = 0;
		printmode(PCSPP);
		printmode(PCSPP);
		printmode(TRISTATE);
		printmode(TRISTATE);
		printmode(COMPAT)
		printmode(COMPAT);
		printmode(EPP);
		printmode(EPP);
//		printmode(ECP);
//		printmode(ECP);
//		printmode(DMA);
//		printmode(DMA);
+6 −8
Original line number Original line Diff line number Diff line
@@ -2135,18 +2135,16 @@ struct parport *parport_pc_probe_port(unsigned long int base,
	pr_cont(" [");
	pr_cont(" [");


#define printmode(x)							\
#define printmode(x)							\
	{\
do {									\
		if (p->modes & PARPORT_MODE_##x) {\
	if (p->modes & PARPORT_MODE_##x)				\
			pr_cont("%s%s", f ? "," : "", #x);	\
		pr_cont("%s%s", f++ ? "," : "", #x);			\
			f++;\
} while (0)
		} \
	}


	{
	{
		int f = 0;
		int f = 0;
		printmode(PCSPP);
		printmode(PCSPP);
		printmode(TRISTATE);
		printmode(TRISTATE);
		printmode(COMPAT)
		printmode(COMPAT);
		printmode(EPP);
		printmode(EPP);
		printmode(ECP);
		printmode(ECP);
		printmode(DMA);
		printmode(DMA);
+5 −1
Original line number Original line Diff line number Diff line
@@ -213,7 +213,11 @@ static int do_hardware_modes(struct ctl_table *table, int write,
		return -EACCES;
		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;
		int f = 0;
		printmode(PCSPP);
		printmode(PCSPP);
		printmode(TRISTATE);
		printmode(TRISTATE);