From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Linus Walleij <linus.walleij@linaro.org>,
linux-kernel@vger.kernel.org,
Mika Westerberg <mika.westerberg@linux.intel.com>
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Subject: [PATCH 4/5] pinctrl-baytrail: introduce to_byt_gpio() macro
Date: Wed, 10 Jul 2013 14:55:39 +0300 [thread overview]
Message-ID: <1373457340-16666-5-git-send-email-andriy.shevchenko@linux.intel.com> (raw)
In-Reply-To: <1373457340-16666-1-git-send-email-andriy.shevchenko@linux.intel.com>
The introduced macro helps to convert struct gpio_chip to struct byt_gpio.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
drivers/pinctrl/pinctrl-baytrail.c | 18 ++++++++++--------
1 file changed, 10 insertions(+), 8 deletions(-)
diff --git a/drivers/pinctrl/pinctrl-baytrail.c b/drivers/pinctrl/pinctrl-baytrail.c
index 14a143c..14e1e22 100644
--- a/drivers/pinctrl/pinctrl-baytrail.c
+++ b/drivers/pinctrl/pinctrl-baytrail.c
@@ -130,10 +130,12 @@ struct byt_gpio {
struct pinctrl_gpio_range *range;
};
+#define to_byt_gpio(c) container_of(c, struct byt_gpio, chip)
+
static void __iomem *byt_gpio_reg(struct gpio_chip *chip, unsigned offset,
int reg)
{
- struct byt_gpio *vg = container_of(chip, struct byt_gpio, chip);
+ struct byt_gpio *vg = to_byt_gpio(chip);
u32 reg_offset;
if (reg == BYT_INT_STAT_REG)
@@ -146,7 +148,7 @@ static void __iomem *byt_gpio_reg(struct gpio_chip *chip, unsigned offset,
static int byt_gpio_request(struct gpio_chip *chip, unsigned offset)
{
- struct byt_gpio *vg = container_of(chip, struct byt_gpio, chip);
+ struct byt_gpio *vg = to_byt_gpio(chip);
pm_runtime_get(&vg->pdev->dev);
@@ -155,7 +157,7 @@ static int byt_gpio_request(struct gpio_chip *chip, unsigned offset)
static void byt_gpio_free(struct gpio_chip *chip, unsigned offset)
{
- struct byt_gpio *vg = container_of(chip, struct byt_gpio, chip);
+ struct byt_gpio *vg = to_byt_gpio(chip);
void __iomem *reg = byt_gpio_reg(&vg->chip, offset, BYT_CONF0_REG);
u32 value;
@@ -216,7 +218,7 @@ static int byt_gpio_get(struct gpio_chip *chip, unsigned offset)
static void byt_gpio_set(struct gpio_chip *chip, unsigned offset, int value)
{
- struct byt_gpio *vg = container_of(chip, struct byt_gpio, chip);
+ struct byt_gpio *vg = to_byt_gpio(chip);
void __iomem *reg = byt_gpio_reg(chip, offset, BYT_VAL_REG);
unsigned long flags;
u32 old_val;
@@ -235,7 +237,7 @@ static void byt_gpio_set(struct gpio_chip *chip, unsigned offset, int value)
static int byt_gpio_direction_input(struct gpio_chip *chip, unsigned offset)
{
- struct byt_gpio *vg = container_of(chip, struct byt_gpio, chip);
+ struct byt_gpio *vg = to_byt_gpio(chip);
void __iomem *reg = byt_gpio_reg(chip, offset, BYT_VAL_REG);
unsigned long flags;
u32 value;
@@ -254,7 +256,7 @@ static int byt_gpio_direction_input(struct gpio_chip *chip, unsigned offset)
static int byt_gpio_direction_output(struct gpio_chip *chip,
unsigned gpio, int value)
{
- struct byt_gpio *vg = container_of(chip, struct byt_gpio, chip);
+ struct byt_gpio *vg = to_byt_gpio(chip);
void __iomem *reg = byt_gpio_reg(chip, gpio, BYT_VAL_REG);
unsigned long flags;
u32 reg_val;
@@ -272,7 +274,7 @@ static int byt_gpio_direction_output(struct gpio_chip *chip,
static void byt_gpio_dbg_show(struct seq_file *s, struct gpio_chip *chip)
{
- struct byt_gpio *vg = container_of(chip, struct byt_gpio, chip);
+ struct byt_gpio *vg = to_byt_gpio(chip);
int i;
unsigned long flags;
u32 conf0, val, offs;
@@ -301,7 +303,7 @@ static void byt_gpio_dbg_show(struct seq_file *s, struct gpio_chip *chip)
static int byt_gpio_to_irq(struct gpio_chip *chip, unsigned offset)
{
- struct byt_gpio *vg = container_of(chip, struct byt_gpio, chip);
+ struct byt_gpio *vg = to_byt_gpio(chip);
return irq_create_mapping(vg->domain, offset);
}
--
1.8.3.2
next prev parent reply other threads:[~2013-07-10 11:56 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-07-10 11:55 [PATCH 0/5] pinctrl-baytrail: miscellaneous minor fixes Andy Shevchenko
2013-07-10 11:55 ` [PATCH 1/5] pinctrl-baytrail: fix indentations Andy Shevchenko
2013-07-22 20:47 ` Linus Walleij
2013-07-10 11:55 ` [PATCH 2/5] pinctrl-baytrail: change lvl to level Andy Shevchenko
2013-07-10 13:42 ` [PATCH v1.5] " Andy Shevchenko
2013-07-22 20:48 ` Linus Walleij
2013-07-10 11:55 ` [PATCH 3/5] pinctrl-baytrail: remove redundant ptr variable Andy Shevchenko
2013-07-22 20:49 ` Linus Walleij
2013-07-10 11:55 ` Andy Shevchenko [this message]
2013-07-22 20:50 ` [PATCH 4/5] pinctrl-baytrail: introduce to_byt_gpio() macro Linus Walleij
2013-07-10 11:55 ` [PATCH 5/5] pinctrl-baytrail: fix to avoid sparse warnings Andy Shevchenko
2013-07-22 20:51 ` Linus Walleij
2013-07-15 10:24 ` [PATCH 0/5] pinctrl-baytrail: miscellaneous minor fixes Andy Shevchenko
2013-07-15 18:34 ` Mika Westerberg
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=1373457340-16666-5-git-send-email-andriy.shevchenko@linux.intel.com \
--to=andriy.shevchenko@linux.intel.com \
--cc=linus.walleij@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mika.westerberg@linux.intel.com \
/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