* [PATCH v2 1/4] sh-pfc: Add support for SoC-specific initialization
@ 2013-04-24 22:00 Laurent Pinchart
2013-04-26 10:13 ` Linus Walleij
2013-04-26 10:18 ` Laurent Pinchart
0 siblings, 2 replies; 3+ messages in thread
From: Laurent Pinchart @ 2013-04-24 22:00 UTC (permalink / raw)
To: linux-sh
Add two optional init and cleanup SoC operations and call them from the
core at probe and remove time.
Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
---
drivers/pinctrl/sh-pfc/core.c | 16 +++++++++++++++-
drivers/pinctrl/sh-pfc/core.h | 1 +
drivers/pinctrl/sh-pfc/sh_pfc.h | 2 ++
3 files changed, 18 insertions(+), 1 deletion(-)
diff --git a/drivers/pinctrl/sh-pfc/core.c b/drivers/pinctrl/sh-pfc/core.c
index 4540ce3..5576e8a 100644
--- a/drivers/pinctrl/sh-pfc/core.c
+++ b/drivers/pinctrl/sh-pfc/core.c
@@ -372,6 +372,12 @@ static int sh_pfc_probe(struct platform_device *pdev)
spin_lock_init(&pfc->lock);
+ if (info->ops && info->ops->init) {
+ ret = info->ops->init(pfc);
+ if (ret < 0)
+ return ret;
+ }
+
pinctrl_provide_dummies();
/*
@@ -379,7 +385,7 @@ static int sh_pfc_probe(struct platform_device *pdev)
*/
ret = sh_pfc_register_pinctrl(pfc);
if (unlikely(ret != 0))
- return ret;
+ goto error;
#ifdef CONFIG_GPIO_SH_PFC
/*
@@ -401,6 +407,11 @@ static int sh_pfc_probe(struct platform_device *pdev)
dev_info(pfc->dev, "%s support registered\n", info->name);
return 0;
+
+error:
+ if (info->ops && info->ops->cleanup)
+ info->ops->cleanup(pfc);
+ return ret;
}
static int sh_pfc_remove(struct platform_device *pdev)
@@ -412,6 +423,9 @@ static int sh_pfc_remove(struct platform_device *pdev)
#endif
sh_pfc_unregister_pinctrl(pfc);
+ if (pfc->info->ops && pfc->info->ops->cleanup)
+ pfc->info->ops->cleanup(pfc);
+
platform_set_drvdata(pdev, NULL);
return 0;
diff --git a/drivers/pinctrl/sh-pfc/core.h b/drivers/pinctrl/sh-pfc/core.h
index e847afb..f02ba1d 100644
--- a/drivers/pinctrl/sh-pfc/core.h
+++ b/drivers/pinctrl/sh-pfc/core.h
@@ -28,6 +28,7 @@ struct sh_pfc_pinctrl;
struct sh_pfc {
struct device *dev;
const struct sh_pfc_soc_info *info;
+ void *soc_data;
spinlock_t lock;
unsigned int num_windows;
diff --git a/drivers/pinctrl/sh-pfc/sh_pfc.h b/drivers/pinctrl/sh-pfc/sh_pfc.h
index b170761..acb1bb0 100644
--- a/drivers/pinctrl/sh-pfc/sh_pfc.h
+++ b/drivers/pinctrl/sh-pfc/sh_pfc.h
@@ -129,6 +129,8 @@ struct pinmux_range {
struct sh_pfc;
struct sh_pfc_soc_operations {
+ int (*init)(struct sh_pfc *pfc);
+ void (*cleanup)(struct sh_pfc *pfc);
unsigned int (*get_bias)(struct sh_pfc *pfc, unsigned int pin);
void (*set_bias)(struct sh_pfc *pfc, unsigned int pin,
unsigned int bias);
--
1.8.1.5
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH v2 1/4] sh-pfc: Add support for SoC-specific initialization
2013-04-24 22:00 [PATCH v2 1/4] sh-pfc: Add support for SoC-specific initialization Laurent Pinchart
@ 2013-04-26 10:13 ` Linus Walleij
2013-04-26 10:18 ` Laurent Pinchart
1 sibling, 0 replies; 3+ messages in thread
From: Linus Walleij @ 2013-04-26 10:13 UTC (permalink / raw)
To: linux-sh
On Thu, Apr 25, 2013 at 12:00 AM, Laurent Pinchart
<laurent.pinchart+renesas@ideasonboard.com> wrote:
> Add two optional init and cleanup SoC operations and call them from the
> core at probe and remove time.
>
> Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Same comment: init/exit is more natural than init/cleanup.
Yours,
Linus Wallleij
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v2 1/4] sh-pfc: Add support for SoC-specific initialization
2013-04-24 22:00 [PATCH v2 1/4] sh-pfc: Add support for SoC-specific initialization Laurent Pinchart
2013-04-26 10:13 ` Linus Walleij
@ 2013-04-26 10:18 ` Laurent Pinchart
1 sibling, 0 replies; 3+ messages in thread
From: Laurent Pinchart @ 2013-04-26 10:18 UTC (permalink / raw)
To: linux-sh
Hi Linus,
On Friday 26 April 2013 12:13:26 Linus Walleij wrote:
> On Thu, Apr 25, 2013 at 12:00 AM, Laurent Pinchart wrote:
> > Add two optional init and cleanup SoC operations and call them from the
> > core at probe and remove time.
> >
> > Signed-off-by: Laurent Pinchart
> > <laurent.pinchart+renesas@ideasonboard.com>
>
> Same comment: init/exit is more natural than init/cleanup.
Thanks for the review. I'll fix that.
--
Regards,
Laurent Pinchart
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-04-26 10:18 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-04-24 22:00 [PATCH v2 1/4] sh-pfc: Add support for SoC-specific initialization Laurent Pinchart
2013-04-26 10:13 ` Linus Walleij
2013-04-26 10:18 ` Laurent Pinchart
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).