Re: [PATCH 1/2] dump_audio_bmcontrols(): tell users about faulty bmControl bits

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Jun 03, 2010 at 02:21:59PM +0400, Sergei Shtylyov wrote:
> Daniel Mack wrote:
> >>Daniel Mack wrote:
> >>>Signed-off-by: Daniel Mack <daniel@xxxxxxxx>
> >>[...]
> >>>diff --git a/lsusb.c b/lsusb.c
> >>>index 43ce219..b0b073d 100644
> >>>--- a/lsusb.c
> >>>+++ b/lsusb.c
> >>>@@ -939,12 +939,16 @@ static void dump_audio_bmcontrols(const char *prefix, int bmcontrols, const stru
> >>>			break;
> >>>-		case USB_AUDIO_CLASS_2:
> >>>-			if (bmcontrols & (1 << (list->bit * 2)))
> >>>-				printf("%s%s Control (%s)\n", prefix, list->name,
> >>>-					bmcontrols & (2 << (list->bit * 2)) ? "read/write" : "read-only");
> >>>+		case USB_AUDIO_CLASS_2: {
> >>>+			const char *ctrl_type[] = { "read-only", "ILLEGAL (0b10)", "read/write" };
> >>>+			int ctrl = (bmcontrols >> (list->bit * 2)) & 0x3;
> >>>+
> >>>+			if (ctrl)
> >>>+				printf("%s%s Control (%s)\n", prefix, list->name, ctrl_type[ctrl-1]);
> >>>			break;
> >>>+		}
> >>>+
> >>>		} /* switch */
> >>   Hm, why this { at the same indent level?
> 
> >because the 'case' block opens a '{'. I couldn't find a better solution
> >for this, except for making the variables non-local.
> 
>    I think you should have indented your code one level more then:
> 
> 		case USB_AUDIO_CLASS_2:
> 			{
> 			/* ... */
> 			}

... and have the brackets at the same indent level that the code? Hmm I
dunno whether I like this any better, and I think this is a matter of
taste.

Greg, feel free to change that as you wish in case you plan to commit :)

Thanks,
Daniel

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux