[PATCH 1/2] gpio: mvebu: add dbg_show function

Thomas Petazzoni thomas.petazzoni at free-electrons.com
Sat Mar 23 11:21:18 EDT 2013


Dear Simon Guinot,

On Fri, 22 Mar 2013 19:49:47 +0100, Simon Guinot wrote:
> +	for (i = 0; i < chip->ngpio; i++) {
> +		const char *label;
> +		int msk;
> +		bool is_out;
> +
> +		label = gpiochip_is_requested(chip, i);
> +		if (!label)
> +			continue;
> +
> +		msk = 1 << i;
> +		is_out = !(io_conf & msk);

Maybe instead of using 'msk' you could use test_bit() ?

		is_out = !test_bit(i, io_conf);

> +		seq_printf(s, " gpio-%-3d (%-20.20s)", chip->base + i, label);
> +
> +		if (is_out) {
> +			seq_printf(s, " out %s %s\n",
> +				   out & msk ? "hi" : "lo",

				   test_bit(i, out) ? "hi" : "lo",

> +				   blink & msk ? "(blink )" : "");

				   test_bit(i, blink) ? "(blink )" : ""

etc.

Thomas
-- 
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com



More information about the linux-arm-kernel mailing list