On Fri, Nov 15, 2013 at 7:42 AM, Alexander Shiyan <[email protected]> wrote:
> SYSCON driver was designed for using memory areas (registers) > that are used in several subsystems. There are systems (CPUs) > which use bits in one register for various purposes and thus > should be handled by various kernel subsystems. This driver > allows you to use the individual SYSCON bits as GPIOs. > This is RFC only yet, so I did not add DT bindings for this > driver. > > Signed-off-by: Alexander Shiyan <[email protected]> Good idea. I like the general concept. > +struct syscon_gpio_priv { > + struct gpio_chip chip; > + struct regmap *syscon; > + u32 bit_offset; Use a simple unsigned int for bit offset please. > +static int syscon_gpio_get(struct gpio_chip *chip, unsigned offset) > +{ > + struct syscon_gpio_priv *priv = to_syscon_gpio(chip); > + unsigned int val; > + int ret; > + > + ret = regmap_read(priv->syscon, priv->bit_offset / 32, &val); > + if (ret < 0) > + return ret; > + > + return !!(val & (priv->bit_offset % 32)); > +} Grrr OK drivers/mfd/syscon has its regmap constrained like that: static struct regmap_config syscon_regmap_config = { .reg_bits = 32, .val_bits = 32, .reg_stride = 4, }; Assuming just like the people causing the y2k problem that "32 bits ought to fit everyone". This is not your fault, but I'd like you to insert a big comment explaining that the syscon driver semantics hammer down the 32 bit register width and there is nothing you can do about it. Yours, Linus Walleij -- To unsubscribe from this list: send the line "unsubscribe linux-gpio" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
