>> +static inline void set_gpio_bits(unsigned n, void __iomem *reg)
I don't think that will work well, because there are cases where we want
to set or clear more than one bit at a time. Making these functions
take a bit number as an argument would restrict them to setting or clearing
only one bit at a time, forcing users to call them multiple times to set
or clear more than one bit, meaning lots of readl & writel calls for
compount bit-changes.
If the chip is ever moved, not accounting for the base would produce an error.
I know that 'speculative coding' is frowned upon, but isn't removing an
addition (as you pointed out, the subtraction is a bug) because this instance
of the chip is at offset zero a little over the top?
Why make two readl/writel call pairs, or have one version of a helper which
can set a single bit and another version which can set more than one
at a time? That seems really complicated.
--
Employee of Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
--