diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2020-10-14 12:46:27 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2020-10-14 12:46:27 +0200 |
commit | d5a40ed62b34ec05ca6e496748ac551560e0846f (patch) | |
tree | 5e40828cb4c4fd40a2a6d54b7cc32fff896ecd45 /drivers | |
parent | 11d027ac6b069c9371de3e1859dd0165a60826c3 (diff) | |
parent | 81ec6c1a882b0d8505eb7294e71f4b3fc6c9823b (diff) | |
download | barebox-d5a40ed62b34ec05ca6e496748ac551560e0846f.tar.gz barebox-d5a40ed62b34ec05ca6e496748ac551560e0846f.tar.xz |
Merge branch 'for-next/deep-probe-prepare' into master
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/of/platform.c | 2 | ||||
-rw-r--r-- | drivers/regulator/anatop-regulator.c | 1 | ||||
-rw-r--r-- | drivers/regulator/bcm2835.c | 24 | ||||
-rw-r--r-- | drivers/regulator/core.c | 6 | ||||
-rw-r--r-- | drivers/regulator/fixed.c | 1 | ||||
-rw-r--r-- | drivers/regulator/stm32-pwr.c | 7 | ||||
-rw-r--r-- | drivers/regulator/stpmic1_regulator.c | 8 | ||||
-rw-r--r-- | drivers/spi/spi.c | 4 | ||||
-rw-r--r-- | drivers/video/ssd1307fb.c | 2 |
9 files changed, 32 insertions, 23 deletions
diff --git a/drivers/of/platform.c b/drivers/of/platform.c index ca84cede23..21c7cce1a5 100644 --- a/drivers/of/platform.c +++ b/drivers/of/platform.c @@ -282,7 +282,7 @@ amba_err_free: return NULL; } #else /* CONFIG_ARM_AMBA */ -static inline struct amba_device *of_amba_device_create(struct device_node *np) +static inline struct device_d *of_amba_device_create(struct device_node *np) { return NULL; } diff --git a/drivers/regulator/anatop-regulator.c b/drivers/regulator/anatop-regulator.c index 7ec9446a0a..917f7e8fdd 100644 --- a/drivers/regulator/anatop-regulator.c +++ b/drivers/regulator/anatop-regulator.c @@ -67,6 +67,7 @@ static int anatop_regulator_probe(struct device_d *dev) rdev->desc = rdesc; rdev->regmap = syscon_node_to_regmap(anatop_np); + rdev->dev = dev; if (IS_ERR(rdev->regmap)) return PTR_ERR(rdev->regmap); diff --git a/drivers/regulator/bcm2835.c b/drivers/regulator/bcm2835.c index ea7cf7fe1e..6423b8a834 100644 --- a/drivers/regulator/bcm2835.c +++ b/drivers/regulator/bcm2835.c @@ -14,7 +14,7 @@ #define REG_DEV(_id, _name) \ { \ - .id = _id, \ + .id = _id, \ .devname = _name,\ } @@ -22,7 +22,6 @@ static struct regulator_bcm2835 { int id; char *devname; - struct device_d *dev; struct regulator_dev rdev; struct regulator_desc rdesc; } regs[] = { @@ -43,8 +42,9 @@ struct msg_set_power_state { u32 end_tag; }; -static int regulator_bcm2835_set(struct regulator_bcm2835 *rb, int state) +static int regulator_bcm2835_set(struct regulator_dev *rdev, int state) { + struct regulator_bcm2835 *rb = container_of(rdev, struct regulator_bcm2835, rdev); BCM2835_MBOX_STACK_ALIGN(struct msg_set_power_state, msg_pwr); int ret; @@ -59,8 +59,8 @@ static int regulator_bcm2835_set(struct regulator_bcm2835 *rb, int state) ret = bcm2835_mbox_call_prop(BCM2835_MBOX_PROP_CHAN, &msg_pwr->hdr); if (ret) { - dev_err(rb->dev ,"bcm2835: Could not set module %u power state\n", - rb->id); + dev_err(rdev->dev, "bcm2835: Could not set module %u power state\n", + rb->id); return ret; } @@ -69,16 +69,12 @@ static int regulator_bcm2835_set(struct regulator_bcm2835 *rb, int state) static int regulator_bcm2835_enable(struct regulator_dev *rdev) { - struct regulator_bcm2835 *rb = container_of(rdev, struct regulator_bcm2835, rdev); - - return regulator_bcm2835_set(rb, BCM2835_MBOX_SET_POWER_STATE_REQ_ON); + return regulator_bcm2835_set(rdev, BCM2835_MBOX_SET_POWER_STATE_REQ_ON); } static int regulator_bcm2835_disable(struct regulator_dev *rdev) { - struct regulator_bcm2835 *rb = container_of(rdev, struct regulator_bcm2835, rdev); - - return regulator_bcm2835_set(rb, BCM2835_MBOX_SET_POWER_STATE_REQ_OFF); + return regulator_bcm2835_set(rdev, BCM2835_MBOX_SET_POWER_STATE_REQ_OFF); } struct msg_get_power_state { @@ -101,8 +97,8 @@ static int regulator_bcm2835_is_enabled(struct regulator_dev *rdev) ret = bcm2835_mbox_call_prop(BCM2835_MBOX_PROP_CHAN, &msg_pwr->hdr); if (ret) { - dev_err(rb->dev ,"bcm2835: Could not get module %u power state\n", - rb->id); + dev_err(rdev->dev, "bcm2835: Could not get module %u power state\n", + rb->id); return ret; } @@ -125,7 +121,7 @@ static int regulator_bcm2835_probe(struct device_d *dev) rb->rdesc.ops = &bcm2835_ops; rb->rdev.desc = &rb->rdesc; - rb->dev = dev; + rb->rdev.dev = dev; ret = dev_regulator_register(&rb->rdev, rb->devname, NULL); if (ret) diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c index 74e00d7791..6ea21a4609 100644 --- a/drivers/regulator/core.c +++ b/drivers/regulator/core.c @@ -163,11 +163,17 @@ int of_regulator_register(struct regulator_dev *rd, struct device_node *node) struct regulator_internal *ri; const char *name; + if (!rd || !node) + return -EINVAL; + rd->boot_on = of_property_read_bool(node, "regulator-boot-on"); name = of_get_property(node, "regulator-name", NULL); ri = __regulator_register(rd, name); + if (IS_ERR(ri)) + return PTR_ERR(ri); + ri->node = node; of_property_read_u32(node, "regulator-enable-ramp-delay", diff --git a/drivers/regulator/fixed.c b/drivers/regulator/fixed.c index 0b1c752493..160a55163f 100644 --- a/drivers/regulator/fixed.c +++ b/drivers/regulator/fixed.c @@ -82,6 +82,7 @@ static int regulator_fixed_probe(struct device_d *dev) fix->rdesc.ops = &fixed_ops; fix->rdev.desc = &fix->rdesc; + fix->rdev.dev = dev; if (of_find_property(dev->device_node, "regulator-always-on", NULL) || of_find_property(dev->device_node, "regulator-boot-on", NULL)) { diff --git a/drivers/regulator/stm32-pwr.c b/drivers/regulator/stm32-pwr.c index 296f95bc4c..54ba716a8f 100644 --- a/drivers/regulator/stm32-pwr.c +++ b/drivers/regulator/stm32-pwr.c @@ -44,7 +44,6 @@ static u32 ready_mask_table[STM32PWR_REG_NUM_REGS] = { struct stm32_pwr_reg { void __iomem *base; - struct device_d *dev; u32 ready_mask; struct regulator_dev rdev; struct regulator *supply; @@ -97,7 +96,7 @@ static int stm32_pwr_reg_enable(struct regulator_dev *rdev) ret = readx_poll_timeout(stm32_pwr_reg_is_ready, rdev, val, val, 20 * USEC_PER_MSEC); if (ret) - dev_err(priv->dev, "%s: regulator enable timed out!\n", + dev_err(rdev->dev, "%s: regulator enable timed out!\n", desc->name); return ret; @@ -118,7 +117,7 @@ static int stm32_pwr_reg_disable(struct regulator_dev *rdev) ret = readx_poll_timeout(stm32_pwr_reg_is_ready, rdev, val, !val, 20 * USEC_PER_MSEC); if (ret) - dev_err(priv->dev, "%s: regulator disable timed out!\n", + dev_err(rdev->dev, "%s: regulator disable timed out!\n", desc->name); regulator_disable(priv->supply); @@ -179,9 +178,9 @@ static int stm32_pwr_regulator_probe(struct device_d *dev) priv = xzalloc(sizeof(*priv)); priv->base = IOMEM(iores->start); priv->ready_mask = ready_mask_table[i]; - priv->dev = dev; priv->rdev.desc = &desc->desc; + priv->rdev.dev = dev; priv->supply = regulator_get(dev, desc->supply_name); if (IS_ERR(priv->supply)) diff --git a/drivers/regulator/stpmic1_regulator.c b/drivers/regulator/stpmic1_regulator.c index 71a4ae80c3..61227e0855 100644 --- a/drivers/regulator/stpmic1_regulator.c +++ b/drivers/regulator/stpmic1_regulator.c @@ -21,7 +21,6 @@ * @icc_mask: icc register mask */ struct stpmic1_regulator_cfg { - struct device_d *dev; struct regulator_dev rdev; struct regulator_desc desc; u8 mask_reset_reg; @@ -383,8 +382,13 @@ static int stpmic1_regulator_register(struct device_d *dev, int id, { int ret; - cfg->dev = dev; + if (!match->of_node) { + dev_dbg(dev, "Skip missing DTB regulator %s", match->name); + return 0; + } + cfg->rdev.desc = &cfg->desc; + cfg->rdev.dev = dev; cfg->rdev.regmap = dev_get_regmap(dev->parent, NULL); if (IS_ERR(cfg->rdev.regmap)) return PTR_ERR(cfg->rdev.regmap); diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c index 0694f14c39..8421d9d7c1 100644 --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c @@ -103,7 +103,9 @@ struct spi_device *spi_new_device(struct spi_controller *ctrl, goto fail; } - register_device(&proxy->dev); + status = register_device(&proxy->dev); + if (status) + goto fail; return proxy; fail: diff --git a/drivers/video/ssd1307fb.c b/drivers/video/ssd1307fb.c index 0709399358..994f43dc5c 100644 --- a/drivers/video/ssd1307fb.c +++ b/drivers/video/ssd1307fb.c @@ -421,7 +421,7 @@ static int ssd1307fb_probe(struct device_d *dev) goto fb_alloc_error; } - par->vbat = regulator_get(&client->dev, "vbat-supply"); + par->vbat = regulator_get(&client->dev, "vbat"); if (IS_ERR(par->vbat)) { dev_info(&client->dev, "Will not use VBAT"); par->vbat = NULL; |