linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: Douglas Anderson <dianders@chromium.org>, linus.walleij@linaro.org
Cc: Bartosz Golaszewski <bgolaszewski@baylibre.com>,
	linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/2] gpio: Make "offset" and "unsigned int", not just "unsigned"
Date: Tue, 28 Apr 2020 17:38:15 -0700	[thread overview]
Message-ID: <a23b7a97f349e6f74b993a4e127564ad3f7d6929.camel@perches.com> (raw)
In-Reply-To: <20200428172322.2.Iacb3c8152c3cf9015a91308678155a578b0cc050@changeid>

On Tue, 2020-04-28 at 17:23 -0700, Douglas Anderson wrote:
> When I copied the function prototypes from the GPIO header file into
> my own driver, checkpatch yelled at me saying that I shouldn't use use
> "unsigned" but instead should say "unsigned int".  Let's make the
> header file use "unsigned int" so others who copy like I did won't get
> yelled at.

There are a few other unsigned declarations in the file.
Maybe do all of them (and remove the unnecessary externs)?

trivial reformatting of the function pointer block too
---
 include/linux/gpio/driver.h | 79 ++++++++++++++++++---------------------------
 1 file changed, 32 insertions(+), 47 deletions(-)

diff --git a/include/linux/gpio/driver.h b/include/linux/gpio/driver.h
index b8fc92c..478fb0 100644
--- a/include/linux/gpio/driver.h
+++ b/include/linux/gpio/driver.h
@@ -348,40 +348,26 @@ struct gpio_chip {
 	struct device		*parent;
 	struct module		*owner;
 
-	int			(*request)(struct gpio_chip *gc,
-						unsigned offset);
-	void			(*free)(struct gpio_chip *gc,
-						unsigned offset);
-	int			(*get_direction)(struct gpio_chip *gc,
-						unsigned offset);
-	int			(*direction_input)(struct gpio_chip *gc,
-						unsigned offset);
-	int			(*direction_output)(struct gpio_chip *gc,
-						unsigned offset, int value);
-	int			(*get)(struct gpio_chip *gc,
-						unsigned offset);
-	int			(*get_multiple)(struct gpio_chip *gc,
-						unsigned long *mask,
-						unsigned long *bits);
-	void			(*set)(struct gpio_chip *gc,
-						unsigned offset, int value);
-	void			(*set_multiple)(struct gpio_chip *gc,
-						unsigned long *mask,
-						unsigned long *bits);
-	int			(*set_config)(struct gpio_chip *gc,
-					      unsigned offset,
-					      unsigned long config);
-	int			(*to_irq)(struct gpio_chip *gc,
-						unsigned offset);
-
-	void			(*dbg_show)(struct seq_file *s,
-						struct gpio_chip *gc);
-
-	int			(*init_valid_mask)(struct gpio_chip *gc,
-						   unsigned long *valid_mask,
-						   unsigned int ngpios);
-
-	int			(*add_pin_ranges)(struct gpio_chip *gc);
+	int	(*request)(struct gpio_chip *gc, unsigned int offset);
+	void	(*free)(struct gpio_chip *gc, unsigned int offset);
+	int	(*get_direction)(struct gpio_chip *gc, unsigned int offset);
+	int	(*direction_input)(struct gpio_chip *gc, unsigned int offset);
+	int	(*direction_output)(struct gpio_chip *gc,
+				    unsigned int offset, int value);
+	int	(*get)(struct gpio_chip *gc, unsigned int offset);
+	int	(*get_multiple)(struct gpio_chip *gc,
+				unsigned long *mask, unsigned long *bits);
+	void	(*set)(struct gpio_chip *gc, unsigned int offset, int value);
+	void	(*set_multiple)(struct gpio_chip *gc,
+				unsigned long *mask, unsigned long *bits);
+	int	(*set_config)(struct gpio_chip *gc,
+			      unsigned int offset, unsigned long config);
+	int	(*to_irq)(struct gpio_chip *gc, unsigned int offset);
+	void	(*dbg_show)(struct seq_file *s, struct gpio_chip *gc);
+	int	(*init_valid_mask)(struct gpio_chip *gc,
+				   unsigned long *valid_mask,
+				   unsigned int ngpios);
+	int	(*add_pin_ranges)(struct gpio_chip *gc);
 
 	int			base;
 	u16			ngpio;
@@ -458,13 +444,12 @@ struct gpio_chip {
 #endif /* CONFIG_OF_GPIO */
 };
 
-extern const char *gpiochip_is_requested(struct gpio_chip *gc,
-			unsigned offset);
+const char *gpiochip_is_requested(struct gpio_chip *gc, unsigned int offset);
 
 /* add/remove chips */
-extern int gpiochip_add_data_with_key(struct gpio_chip *gc, void *data,
-				      struct lock_class_key *lock_key,
-				      struct lock_class_key *request_key);
+int gpiochip_add_data_with_key(struct gpio_chip *gc, void *data,
+			       struct lock_class_key *lock_key,
+			       struct lock_class_key *request_key);
 
 /**
  * gpiochip_add_data() - register a gpio_chip
@@ -504,12 +489,12 @@ static inline int gpiochip_add(struct gpio_chip *gc)
 {
 	return gpiochip_add_data(gc, NULL);
 }
-extern void gpiochip_remove(struct gpio_chip *gc);
-extern int devm_gpiochip_add_data(struct device *dev, struct gpio_chip *gc,
-				  void *data);
+void gpiochip_remove(struct gpio_chip *gc);
+int devm_gpiochip_add_data(struct device *dev, struct gpio_chip *gc,
+			   void *data);
 
-extern struct gpio_chip *gpiochip_find(void *data,
-			      int (*match)(struct gpio_chip *gc, void *data));
+struct gpio_chip *gpiochip_find(void *data,
+				int (*match)(struct gpio_chip *gc, void *data));
 
 bool gpiochip_line_is_irq(struct gpio_chip *gc, unsigned int offset);
 int gpiochip_reqres_irq(struct gpio_chip *gc, unsigned int offset);
@@ -657,9 +642,9 @@ static inline int gpiochip_irqchip_add_nested(struct gpio_chip *gc,
 }
 #endif /* CONFIG_LOCKDEP */
 
-int gpiochip_generic_request(struct gpio_chip *gc, unsigned offset);
-void gpiochip_generic_free(struct gpio_chip *gc, unsigned offset);
-int gpiochip_generic_config(struct gpio_chip *gc, unsigned offset,
+int gpiochip_generic_request(struct gpio_chip *gc, unsigned int offset);
+void gpiochip_generic_free(struct gpio_chip *gc, unsigned int offset);
+int gpiochip_generic_config(struct gpio_chip *gc, unsigned int offset,
 			    unsigned long config);
 
 /**


  reply	other threads:[~2020-04-29  0:38 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-29  0:23 [PATCH 1/2] gpio: Document proper return value for gpio drivers Douglas Anderson
2020-04-29  0:23 ` [PATCH 2/2] gpio: Make "offset" and "unsigned int", not just "unsigned" Douglas Anderson
2020-04-29  0:38   ` Joe Perches [this message]
2020-04-29  0:50     ` Doug Anderson
2020-04-29  0:57       ` Joe Perches
2020-04-29  1:04         ` Doug Anderson
2020-04-29  2:32           ` Joe Perches
2020-05-12 21:09     ` Andy Shevchenko
2020-04-29 12:19   ` Linus Walleij
2020-04-29 12:16 ` [PATCH 1/2] gpio: Document proper return value for gpio drivers Linus Walleij

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=a23b7a97f349e6f74b993a4e127564ad3f7d6929.camel@perches.com \
    --to=joe@perches.com \
    --cc=bgolaszewski@baylibre.com \
    --cc=dianders@chromium.org \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).