diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2013-11-15 19:37:40 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-11-15 19:37:40 -0500 |
commit | db0b2d01163cc3050eb52a979541e0d16553be48 (patch) | |
tree | 2a4370fc568e444c98913100b2a520035cc99930 /drivers/mfd/mfd-core.c | |
parent | 16cd9d1c0f149ee0c8073de037e7c57886234aa0 (diff) | |
parent | 90b128ed1557c2f523995a379a53e5105891ecf8 (diff) |
Merge tag 'mfd-3.13-1' of git://git.kernel.org/pub/scm/linux/kernel/git/sameo/mfd-next
Pull MFD updates from Samuel Ortiz:
"For the 3.13 merge window we have a couple of new drivers for the AMS
AS3722 PMIC and for STMicroelectronics STw481x PMIC.
Although this is a smaller update than usual, we also have:
- Device tree support for the max77693 driver
- linux/of.h inclusion for all DT compatible MFD drivers, to avoid
build breakage in the future
- Support for Intel Wildcat Point-LP PCH through the lpc_ich driver
- A small arizona update for new wm5110 DSP registers and a few fixes
- A small palmas update as well, including an of_device table
addition and a few minor fixes
- Two small mfd-core changes, one including a memory leak fix for
when mfd_add_device() fails
- Our usual round of minor cleanups and janitorial fixes"
* tag 'mfd-3.13-1' of git://git.kernel.org/pub/scm/linux/kernel/git/sameo/mfd-next: (63 commits)
Documentation: mfd: Update s2mps11.txt
mfd: pm8921: Potential NULL dereference in pm8921_remove()
mfd: Fix memory leak in mfd_add_devices()
mfd: Stop setting refcounting pointers in original mfd_cell arrays
mfd: wm5110: Enable micd clamp functionality
mfd: lpc_ich: Add Device IDs for Intel Wildcat Point-LP PCH
mfd: max77693: Fix up bug of wrong interrupt number
mfd: as3722: Don't export the regmap config
mfd: twl6040: Remove obsolete cleanup for i2c clientdata
mfd: tps65910: Remove warning during dt node parsing
mfd: lpc_sch: Ignore resource conflicts when adding mfd cells
mfd: ti_am335x_tscadc: Avoid possible deadlock of reg_lock
mfd: syscon: Return -ENOSYS if CONFIG_MFD_SYSCON is not enabled
mfd: Add support for ams AS3722 PMIC
mfd: max77693: Include linux/of.h header
mfd: tc3589x: Detect the precise version
mfd: omap-usb: prepare/unprepare clock while enable/disable
mfd: max77686: Include linux/of.h header
mfd: max8907: Include linux/of.h header
mfd: max8997: Include linux/of.h header
...
Diffstat (limited to 'drivers/mfd/mfd-core.c')
-rw-r--r-- | drivers/mfd/mfd-core.c | 29 |
1 files changed, 17 insertions, 12 deletions
diff --git a/drivers/mfd/mfd-core.c b/drivers/mfd/mfd-core.c index adc8ea36e7c4..267649244737 100644 --- a/drivers/mfd/mfd-core.c +++ b/drivers/mfd/mfd-core.c | |||
@@ -64,7 +64,8 @@ int mfd_cell_disable(struct platform_device *pdev) | |||
64 | EXPORT_SYMBOL(mfd_cell_disable); | 64 | EXPORT_SYMBOL(mfd_cell_disable); |
65 | 65 | ||
66 | static int mfd_platform_add_cell(struct platform_device *pdev, | 66 | static int mfd_platform_add_cell(struct platform_device *pdev, |
67 | const struct mfd_cell *cell) | 67 | const struct mfd_cell *cell, |
68 | atomic_t *usage_count) | ||
68 | { | 69 | { |
69 | if (!cell) | 70 | if (!cell) |
70 | return 0; | 71 | return 0; |
@@ -73,11 +74,12 @@ static int mfd_platform_add_cell(struct platform_device *pdev, | |||
73 | if (!pdev->mfd_cell) | 74 | if (!pdev->mfd_cell) |
74 | return -ENOMEM; | 75 | return -ENOMEM; |
75 | 76 | ||
77 | pdev->mfd_cell->usage_count = usage_count; | ||
76 | return 0; | 78 | return 0; |
77 | } | 79 | } |
78 | 80 | ||
79 | static int mfd_add_device(struct device *parent, int id, | 81 | static int mfd_add_device(struct device *parent, int id, |
80 | const struct mfd_cell *cell, | 82 | const struct mfd_cell *cell, atomic_t *usage_count, |
81 | struct resource *mem_base, | 83 | struct resource *mem_base, |
82 | int irq_base, struct irq_domain *domain) | 84 | int irq_base, struct irq_domain *domain) |
83 | { | 85 | { |
@@ -123,7 +125,7 @@ static int mfd_add_device(struct device *parent, int id, | |||
123 | goto fail_alias; | 125 | goto fail_alias; |
124 | } | 126 | } |
125 | 127 | ||
126 | ret = mfd_platform_add_cell(pdev, cell); | 128 | ret = mfd_platform_add_cell(pdev, cell, usage_count); |
127 | if (ret) | 129 | if (ret) |
128 | goto fail_alias; | 130 | goto fail_alias; |
129 | 131 | ||
@@ -192,12 +194,12 @@ fail_alloc: | |||
192 | } | 194 | } |
193 | 195 | ||
194 | int mfd_add_devices(struct device *parent, int id, | 196 | int mfd_add_devices(struct device *parent, int id, |
195 | struct mfd_cell *cells, int n_devs, | 197 | const struct mfd_cell *cells, int n_devs, |
196 | struct resource *mem_base, | 198 | struct resource *mem_base, |
197 | int irq_base, struct irq_domain *domain) | 199 | int irq_base, struct irq_domain *domain) |
198 | { | 200 | { |
199 | int i; | 201 | int i; |
200 | int ret = 0; | 202 | int ret; |
201 | atomic_t *cnts; | 203 | atomic_t *cnts; |
202 | 204 | ||
203 | /* initialize reference counting for all cells */ | 205 | /* initialize reference counting for all cells */ |
@@ -207,16 +209,19 @@ int mfd_add_devices(struct device *parent, int id, | |||
207 | 209 | ||
208 | for (i = 0; i < n_devs; i++) { | 210 | for (i = 0; i < n_devs; i++) { |
209 | atomic_set(&cnts[i], 0); | 211 | atomic_set(&cnts[i], 0); |
210 | cells[i].usage_count = &cnts[i]; | 212 | ret = mfd_add_device(parent, id, cells + i, cnts + i, mem_base, |
211 | ret = mfd_add_device(parent, id, cells + i, mem_base, | ||
212 | irq_base, domain); | 213 | irq_base, domain); |
213 | if (ret) | 214 | if (ret) |
214 | break; | 215 | goto fail; |
215 | } | 216 | } |
216 | 217 | ||
217 | if (ret) | 218 | return 0; |
218 | mfd_remove_devices(parent); | ||
219 | 219 | ||
220 | fail: | ||
221 | if (i) | ||
222 | mfd_remove_devices(parent); | ||
223 | else | ||
224 | kfree(cnts); | ||
220 | return ret; | 225 | return ret; |
221 | } | 226 | } |
222 | EXPORT_SYMBOL(mfd_add_devices); | 227 | EXPORT_SYMBOL(mfd_add_devices); |
@@ -271,8 +276,8 @@ int mfd_clone_cell(const char *cell, const char **clones, size_t n_clones) | |||
271 | for (i = 0; i < n_clones; i++) { | 276 | for (i = 0; i < n_clones; i++) { |
272 | cell_entry.name = clones[i]; | 277 | cell_entry.name = clones[i]; |
273 | /* don't give up if a single call fails; just report error */ | 278 | /* don't give up if a single call fails; just report error */ |
274 | if (mfd_add_device(pdev->dev.parent, -1, &cell_entry, NULL, 0, | 279 | if (mfd_add_device(pdev->dev.parent, -1, &cell_entry, |
275 | NULL)) | 280 | cell_entry.usage_count, NULL, 0, NULL)) |
276 | dev_err(dev, "failed to create platform device '%s'\n", | 281 | dev_err(dev, "failed to create platform device '%s'\n", |
277 | clones[i]); | 282 | clones[i]); |
278 | } | 283 | } |