linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] pinctrl: samsung: Use unsigned int for number of controller IO mem resources
@ 2017-06-15 16:33 ` Krzysztof Kozlowski
  2017-06-15 16:33   ` [PATCH 2/2] pinctrl: samsung: Consistently use unsigned instead of u32 for nr_banks Krzysztof Kozlowski
  2017-06-20 12:11   ` [PATCH 1/2] pinctrl: samsung: Use unsigned int for number of controller IO mem resources Sylwester Nawrocki
  0 siblings, 2 replies; 4+ messages in thread
From: Krzysztof Kozlowski @ 2017-06-15 16:33 UTC (permalink / raw)
  To: Tomasz Figa, Krzysztof Kozlowski, Sylwester Nawrocki,
	Linus Walleij, linux-arm-kernel, linux-samsung-soc, linux-gpio,
	linux-kernel

Number of IO memory resources cannot be negative obviously and the
driver depends silently on this (by iterating from 0 to
nr_ext_resources+1).  Make this requirement explicit.

Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
---
 drivers/pinctrl/samsung/pinctrl-samsung.c | 2 +-
 drivers/pinctrl/samsung/pinctrl-samsung.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/pinctrl/samsung/pinctrl-samsung.c b/drivers/pinctrl/samsung/pinctrl-samsung.c
index 86c98c1dec3a..c7ac2b944f57 100644
--- a/drivers/pinctrl/samsung/pinctrl-samsung.c
+++ b/drivers/pinctrl/samsung/pinctrl-samsung.c
@@ -960,7 +960,7 @@ samsung_pinctrl_get_soc_data(struct samsung_pinctrl_drv_data *d,
 	struct samsung_pin_bank *bank;
 	struct resource *res;
 	void __iomem *virt_base[SAMSUNG_PINCTRL_NUM_RESOURCES];
-	int i;
+	unsigned int i;
 
 	id = of_alias_get_id(node, "pinctrl");
 	if (id < 0) {
diff --git a/drivers/pinctrl/samsung/pinctrl-samsung.h b/drivers/pinctrl/samsung/pinctrl-samsung.h
index 15b26c786b1e..49a05f4fc37d 100644
--- a/drivers/pinctrl/samsung/pinctrl-samsung.h
+++ b/drivers/pinctrl/samsung/pinctrl-samsung.h
@@ -231,7 +231,7 @@ struct samsung_retention_data {
 struct samsung_pin_ctrl {
 	const struct samsung_pin_bank_data *pin_banks;
 	u32		nr_banks;
-	int		nr_ext_resources;
+	unsigned int	nr_ext_resources;
 	const struct samsung_retention_data *retention_data;
 
 	int		(*eint_gpio_init)(struct samsung_pinctrl_drv_data *);
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/2] pinctrl: samsung: Consistently use unsigned instead of u32 for nr_banks
  2017-06-15 16:33 ` [PATCH 1/2] pinctrl: samsung: Use unsigned int for number of controller IO mem resources Krzysztof Kozlowski
@ 2017-06-15 16:33   ` Krzysztof Kozlowski
  2017-06-20 10:19     ` Sylwester Nawrocki
  2017-06-20 12:11   ` [PATCH 1/2] pinctrl: samsung: Use unsigned int for number of controller IO mem resources Sylwester Nawrocki
  1 sibling, 1 reply; 4+ messages in thread
From: Krzysztof Kozlowski @ 2017-06-15 16:33 UTC (permalink / raw)
  To: Tomasz Figa, Krzysztof Kozlowski, Sylwester Nawrocki,
	Linus Walleij, linux-arm-kernel, linux-samsung-soc, linux-gpio,
	linux-kernel

Unlike for other countable members, the driver used u32 for number of
banks (nr_banks).  There is no specific need for using fixed-width
integer in this particular place.  Make it consistent.

Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
---
 drivers/pinctrl/samsung/pinctrl-samsung.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/pinctrl/samsung/pinctrl-samsung.h b/drivers/pinctrl/samsung/pinctrl-samsung.h
index 49a05f4fc37d..9af07af6cad6 100644
--- a/drivers/pinctrl/samsung/pinctrl-samsung.h
+++ b/drivers/pinctrl/samsung/pinctrl-samsung.h
@@ -230,7 +230,7 @@ struct samsung_retention_data {
  */
 struct samsung_pin_ctrl {
 	const struct samsung_pin_bank_data *pin_banks;
-	u32		nr_banks;
+	unsigned int	nr_banks;
 	unsigned int	nr_ext_resources;
 	const struct samsung_retention_data *retention_data;
 
@@ -275,7 +275,7 @@ struct samsung_pinctrl_drv_data {
 	unsigned int			nr_functions;
 
 	struct samsung_pin_bank		*pin_banks;
-	u32				nr_banks;
+	unsigned int			nr_banks;
 	unsigned int			pin_base;
 	unsigned int			nr_pins;
 
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 2/2] pinctrl: samsung: Consistently use unsigned instead of u32 for nr_banks
  2017-06-15 16:33   ` [PATCH 2/2] pinctrl: samsung: Consistently use unsigned instead of u32 for nr_banks Krzysztof Kozlowski
@ 2017-06-20 10:19     ` Sylwester Nawrocki
  0 siblings, 0 replies; 4+ messages in thread
From: Sylwester Nawrocki @ 2017-06-20 10:19 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: Tomasz Figa, Linus Walleij, linux-arm-kernel, linux-samsung-soc,
	linux-gpio, linux-kernel

On 06/15/2017 06:33 PM, Krzysztof Kozlowski wrote:
> Unlike for other countable members, the driver used u32 for number of
> banks (nr_banks).  There is no specific need for using fixed-width
> integer in this particular place.  Make it consistent.
> 
> Signed-off-by: Krzysztof Kozlowski<krzk@kernel.org>

Reviewed-by: Sylwester Nawrocki <s.nawrocki@samsung.com>

-- 
Regards,
Sylwester

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/2] pinctrl: samsung: Use unsigned int for number of controller IO mem resources
  2017-06-15 16:33 ` [PATCH 1/2] pinctrl: samsung: Use unsigned int for number of controller IO mem resources Krzysztof Kozlowski
  2017-06-15 16:33   ` [PATCH 2/2] pinctrl: samsung: Consistently use unsigned instead of u32 for nr_banks Krzysztof Kozlowski
@ 2017-06-20 12:11   ` Sylwester Nawrocki
  1 sibling, 0 replies; 4+ messages in thread
From: Sylwester Nawrocki @ 2017-06-20 12:11 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: Tomasz Figa, Linus Walleij, linux-arm-kernel, linux-samsung-soc,
	linux-gpio, linux-kernel

On 06/15/2017 06:33 PM, Krzysztof Kozlowski wrote:
> Number of IO memory resources cannot be negative obviously and the
> driver depends silently on this (by iterating from 0 to
> nr_ext_resources+1).  Make this requirement explicit.
> 
> Signed-off-by: Krzysztof Kozlowski<krzk@kernel.org>

Reviewed-by: Sylwester Nawrocki <s.nawrocki@samsung.com>

-- 
Regards,
Sylwester

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-06-20 12:11 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <CGME20170615163507epcas2p4afd786730362715894d5a178a4ad2040@epcas2p4.samsung.com>
2017-06-15 16:33 ` [PATCH 1/2] pinctrl: samsung: Use unsigned int for number of controller IO mem resources Krzysztof Kozlowski
2017-06-15 16:33   ` [PATCH 2/2] pinctrl: samsung: Consistently use unsigned instead of u32 for nr_banks Krzysztof Kozlowski
2017-06-20 10:19     ` Sylwester Nawrocki
2017-06-20 12:11   ` [PATCH 1/2] pinctrl: samsung: Use unsigned int for number of controller IO mem resources Sylwester Nawrocki

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).