summaryrefslogtreecommitdiff
path: root/drivers/mfd/ucb1x00-core.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/mfd/ucb1x00-core.c')
-rw-r--r--drivers/mfd/ucb1x00-core.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/drivers/mfd/ucb1x00-core.c b/drivers/mfd/ucb1x00-core.c
index 16f64e2b2f77..90edf0352d05 100644
--- a/drivers/mfd/ucb1x00-core.c
+++ b/drivers/mfd/ucb1x00-core.c
@@ -25,6 +25,7 @@
#include <linux/mutex.h>
#include <linux/mfd/ucb1x00.h>
#include <linux/pm.h>
+#include <linux/property.h>
#include <linux/gpio/driver.h>
static DEFINE_MUTEX(ucb1x00_mutex);
@@ -492,6 +493,11 @@ static struct class ucb1x00_class = {
.dev_release = ucb1x00_release,
};
+const struct software_node ucb1x00_gpiochip_node = {
+ .name = "ucb1x00-gpio",
+};
+EXPORT_SYMBOL_GPL(ucb1x00_gpiochip_node);
+
static int ucb1x00_probe(struct mcp *mcp)
{
struct ucb1x00_plat_data *pdata = mcp->attached_device.platform_data;
@@ -530,6 +536,10 @@ static int ucb1x00_probe(struct mcp *mcp)
ucb->id = id;
ucb->mcp = mcp;
+ ret = device_add_software_node(&ucb->dev, &ucb1x00_gpiochip_node);
+ if (ret)
+ goto err_swnode_add;
+
ret = device_add(&ucb->dev);
if (ret)
goto err_dev_add;
@@ -604,6 +614,8 @@ static int ucb1x00_probe(struct mcp *mcp)
err_no_irq:
device_del(&ucb->dev);
err_dev_add:
+ device_remove_software_node(&ucb->dev);
+ err_swnode_add:
put_device(&ucb->dev);
out:
if (pdata && pdata->reset)
@@ -630,7 +642,9 @@ static void ucb1x00_remove(struct mcp *mcp)
irq_set_chained_handler(ucb->irq, NULL);
irq_free_descs(ucb->irq_base, 16);
- device_unregister(&ucb->dev);
+ device_del(&ucb->dev);
+ device_remove_software_node(&ucb->dev);
+ put_device(&ucb->dev);
if (pdata && pdata->reset)
pdata->reset(UCB_RST_REMOVE);