Re: [PATCH] pinctrl: pinctrl-single: Fix pcs_request_gpio() when bits_per_mux != 0

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

 



On 01/22/2018 08:49 AM, Andy Shevchenko wrote:
On Mon, Jan 22, 2018 at 1:03 AM, David Lechner <david@xxxxxxxxxxxxxx> wrote:
This fixes pcs_request_gpio() in the pinctrl-single driver when
bits_per_mux != 0. It appears this was overlooked when the multiple
pins per register feature was added.

Fixes: 4e7e8017a80e ("pinctrl: pinctrl-single: enhance to configure
multiple pins of different modules")

One line?

One line is more important that wrapping to 75 chars?


+                       byte_num = (pcs->bits_per_pin * pin) / BITS_PER_BYTE;
+                       offset = (byte_num / mux_bytes) * mux_bytes;
+                       pin_shift = pin % (pcs->width / pcs->bits_per_pin) *
+                                   pcs->bits_per_pin;

Sounds like playing around pretty well defined macro and functions,
e.g. DIV_ROUND_UP(), round_up().


I admit, I just copied existing code (which may be a reason to leave this the
way it is). But, I only see once place to do this:

	offset = round_down(byte_num, mux_bytes);

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



[Index of Archives]     [Linux SPI]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux