From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Marco Felsch <m.felsch@pengutronix.de>,
Ahmad Fatoum <a.fatoum@pengutronix.de>
Subject: [PATCH v2 9/9] gpiolib: rename gpioinfo_ to gpiodesc_
Date: Thu, 22 Jun 2023 09:23:29 +0200 [thread overview]
Message-ID: <20230622072329.1339317-10-a.fatoum@pengutronix.de> (raw)
In-Reply-To: <20230622072329.1339317-1-a.fatoum@pengutronix.de>
Before renaming struct gpio_info to struct gpio_desc, the name made
sense. With the rename, it might confuse readers, so rename it to
gpiodesc_ instead. The naming scheme is thus: gpiod_ for public API
and gpiodesc_ for private API.
Suggested-by: Marco Felsch <m.felsch@pengutronix.de>
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
drivers/gpio/gpiolib.c | 34 +++++++++++++++++-----------------
1 file changed, 17 insertions(+), 17 deletions(-)
diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
index 2808ac3612fe..bcfdd5a0dd30 100644
--- a/drivers/gpio/gpiolib.c
+++ b/drivers/gpio/gpiolib.c
@@ -81,7 +81,7 @@ static struct gpio_desc *gpio_to_desc(unsigned gpio)
return NULL;
}
-static unsigned gpioinfo_chip_offset(const struct gpio_desc *desc)
+static unsigned gpiodesc_chip_offset(const struct gpio_desc *desc)
{
return (desc - gpio_desc) - desc->chip->base;
}
@@ -95,7 +95,7 @@ static int gpio_adjust_value(const struct gpio_desc *desc,
return !!value ^ desc->active_low;
}
-static int gpioinfo_request(struct gpio_desc *desc, const char *label)
+static int gpiodesc_request(struct gpio_desc *desc, const char *label)
{
int ret;
@@ -108,7 +108,7 @@ static int gpioinfo_request(struct gpio_desc *desc, const char *label)
if (desc->chip->ops->request) {
ret = desc->chip->ops->request(desc->chip,
- gpioinfo_chip_offset(desc));
+ gpiodesc_chip_offset(desc));
if (ret)
goto done;
}
@@ -169,16 +169,16 @@ int gpio_request(unsigned gpio, const char *label)
return -ENODEV;
}
- return gpioinfo_request(desc, label);
+ return gpiodesc_request(desc, label);
}
-static void gpioinfo_free(struct gpio_desc *desc)
+static void gpiodesc_free(struct gpio_desc *desc)
{
if (!desc->requested)
return;
if (desc->chip->ops->free)
- desc->chip->ops->free(desc->chip, gpioinfo_chip_offset(desc));
+ desc->chip->ops->free(desc->chip, gpiodesc_chip_offset(desc));
desc->requested = false;
desc->active_low = false;
@@ -190,7 +190,7 @@ void gpio_free(unsigned gpio)
{
struct gpio_desc *desc = gpio_to_desc(gpio);
- gpioinfo_free(desc);
+ gpiodesc_free(desc);
}
/**
@@ -204,7 +204,7 @@ void gpiod_put(struct gpio_desc *desc)
if (!desc)
return;
- gpioinfo_free(desc);
+ gpiodesc_free(desc);
}
EXPORT_SYMBOL(gpiod_put);
@@ -236,7 +236,7 @@ void gpiod_set_raw_value(struct gpio_desc *desc, int value)
VALIDATE_DESC_VOID(desc);
if (desc->chip->ops->set)
- desc->chip->ops->set(desc->chip, gpioinfo_chip_offset(desc), value);
+ desc->chip->ops->set(desc->chip, gpiodesc_chip_offset(desc), value);
}
EXPORT_SYMBOL(gpiod_set_raw_value);
@@ -294,7 +294,7 @@ int gpiod_get_raw_value(const struct gpio_desc *desc)
if (!desc->chip->ops->get)
return -ENOSYS;
- return desc->chip->ops->get(desc->chip, gpioinfo_chip_offset(desc));
+ return desc->chip->ops->get(desc->chip, gpiodesc_chip_offset(desc));
}
EXPORT_SYMBOL_GPL(gpiod_get_raw_value);
@@ -359,7 +359,7 @@ int gpiod_direction_output_raw(struct gpio_desc *desc, int value)
return -ENOSYS;
return desc->chip->ops->direction_output(desc->chip,
- gpioinfo_chip_offset(desc), value);
+ gpiodesc_chip_offset(desc), value);
}
EXPORT_SYMBOL(gpiod_direction_output_raw);
@@ -426,7 +426,7 @@ int gpiod_direction_input(struct gpio_desc *desc)
return -ENOSYS;
return desc->chip->ops->direction_input(desc->chip,
- gpioinfo_chip_offset(desc));
+ gpiodesc_chip_offset(desc));
}
EXPORT_SYMBOL(gpiod_direction_input);
@@ -446,7 +446,7 @@ int gpio_direction_input(unsigned gpio)
}
EXPORT_SYMBOL(gpio_direction_input);
-static int gpioinfo_request_one(struct gpio_desc *desc, unsigned long flags,
+static int gpiodesc_request_one(struct gpio_desc *desc, unsigned long flags,
const char *label)
{
int err;
@@ -461,7 +461,7 @@ static int gpioinfo_request_one(struct gpio_desc *desc, unsigned long flags,
const bool init_active = (flags & GPIOF_INIT_ACTIVE) == GPIOF_INIT_ACTIVE;
const bool init_high = (flags & GPIOF_INIT_HIGH) == GPIOF_INIT_HIGH;
- err = gpioinfo_request(desc, label);
+ err = gpiodesc_request(desc, label);
if (err)
return err;
@@ -475,7 +475,7 @@ static int gpioinfo_request_one(struct gpio_desc *desc, unsigned long flags,
err = gpiod_direction_output_raw(desc, init_high);
if (err)
- gpioinfo_free(desc);
+ gpiodesc_free(desc);
return err;
}
@@ -493,7 +493,7 @@ int gpio_request_one(unsigned gpio, unsigned long flags, const char *label)
if (!desc)
return -ENODEV;
- return gpioinfo_request_one(desc, flags, label);
+ return gpiodesc_request_one(desc, flags, label);
}
EXPORT_SYMBOL_GPL(gpio_request_one);
@@ -884,7 +884,7 @@ struct gpio_desc *dev_gpiod_get_index(struct device *dev,
label = dev_name(dev);
}
- ret = gpioinfo_request_one(desc, flags, label);
+ ret = gpiodesc_request_one(desc, flags, label);
free(buf);
return ret ? ERR_PTR(ret): desc;
--
2.39.2
next prev parent reply other threads:[~2023-06-22 7:25 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-22 7:23 [PATCH v2 0/9] gpio: add proper gpiod API Ahmad Fatoum
2023-06-22 7:23 ` [PATCH v2 1/9] driver: include dev_print and family from <driver.h> Ahmad Fatoum
2023-06-22 7:23 ` [PATCH v2 2/9] include: linux/printk: define new dev_errp_probe Ahmad Fatoum
2023-06-22 7:23 ` [PATCH v2 3/9] gpio: have gpiod_ functions return and accept pointers Ahmad Fatoum
2023-06-22 7:23 ` [PATCH v2 4/9] gpio: gpiolib: rename struct gpio_info to gpio_desc Ahmad Fatoum
2023-06-22 7:23 ` [PATCH v2 5/9] gpiolib: export proper gpio descriptor API Ahmad Fatoum
2023-06-22 7:23 ` [PATCH v2 6/9] bitmap: implement bitmap_{to,from}_arr{32,64} Ahmad Fatoum
2023-06-22 7:23 ` [PATCH v2 7/9] gpiolib: factor out finding gpio property Ahmad Fatoum
2023-06-22 7:23 ` [PATCH v2 8/9] gpiolib: add support for requesting and setting gpiod arrays Ahmad Fatoum
2023-06-22 7:23 ` Ahmad Fatoum [this message]
2023-06-23 9:34 ` [PATCH v2 0/9] gpio: add proper gpiod API Sascha Hauer
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=20230622072329.1339317-10-a.fatoum@pengutronix.de \
--to=a.fatoum@pengutronix.de \
--cc=barebox@lists.infradead.org \
--cc=m.felsch@pengutronix.de \
/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