diff options
| -rw-r--r-- | Documentation/hwspinlock.txt | 6 | ||||
| -rw-r--r-- | drivers/hwspinlock/hwspinlock_core.c | 4 | ||||
| -rw-r--r-- | drivers/hwspinlock/hwspinlock_internal.h | 4 | ||||
| -rw-r--r-- | drivers/hwspinlock/omap_hwspinlock.c | 2 |
4 files changed, 6 insertions, 10 deletions
diff --git a/Documentation/hwspinlock.txt b/Documentation/hwspinlock.txt index 7dcd1a4e726c..bbaa4649b637 100644 --- a/Documentation/hwspinlock.txt +++ b/Documentation/hwspinlock.txt | |||
| @@ -256,18 +256,16 @@ underlying hwspinlock implementation using the hwspin_lock_register() API. | |||
| 256 | * @ops: vendor-specific hwspinlock handlers | 256 | * @ops: vendor-specific hwspinlock handlers |
| 257 | * @id: a global, unique, system-wide, index of the lock. | 257 | * @id: a global, unique, system-wide, index of the lock. |
| 258 | * @lock: initialized and used by hwspinlock core | 258 | * @lock: initialized and used by hwspinlock core |
| 259 | * @owner: underlying implementation module, used to maintain module ref count | ||
| 260 | */ | 259 | */ |
| 261 | struct hwspinlock { | 260 | struct hwspinlock { |
| 262 | struct device *dev; | 261 | struct device *dev; |
| 263 | const struct hwspinlock_ops *ops; | 262 | const struct hwspinlock_ops *ops; |
| 264 | int id; | 263 | int id; |
| 265 | spinlock_t lock; | 264 | spinlock_t lock; |
| 266 | struct module *owner; | ||
| 267 | }; | 265 | }; |
| 268 | 266 | ||
| 269 | The underlying implementation is responsible to assign the dev, ops, id and | 267 | The underlying implementation is responsible to assign the dev, ops and id |
| 270 | owner members. The lock member, OTOH, is initialized and used by the hwspinlock | 268 | members. The lock member, OTOH, is initialized and used by the hwspinlock |
| 271 | core. | 269 | core. |
| 272 | 270 | ||
| 273 | 6. Implementation callbacks | 271 | 6. Implementation callbacks |
diff --git a/drivers/hwspinlock/hwspinlock_core.c b/drivers/hwspinlock/hwspinlock_core.c index 43a62714b4fb..af5175c5d5f4 100644 --- a/drivers/hwspinlock/hwspinlock_core.c +++ b/drivers/hwspinlock/hwspinlock_core.c | |||
| @@ -352,7 +352,7 @@ static int __hwspin_lock_request(struct hwspinlock *hwlock) | |||
| 352 | int ret; | 352 | int ret; |
| 353 | 353 | ||
| 354 | /* prevent underlying implementation from being removed */ | 354 | /* prevent underlying implementation from being removed */ |
| 355 | if (!try_module_get(hwlock->owner)) { | 355 | if (!try_module_get(hwlock->dev->driver->owner)) { |
| 356 | dev_err(hwlock->dev, "%s: can't get owner\n", __func__); | 356 | dev_err(hwlock->dev, "%s: can't get owner\n", __func__); |
| 357 | return -EINVAL; | 357 | return -EINVAL; |
| 358 | } | 358 | } |
| @@ -535,7 +535,7 @@ int hwspin_lock_free(struct hwspinlock *hwlock) | |||
| 535 | /* sanity check (this shouldn't happen) */ | 535 | /* sanity check (this shouldn't happen) */ |
| 536 | WARN_ON(tmp != hwlock); | 536 | WARN_ON(tmp != hwlock); |
| 537 | 537 | ||
| 538 | module_put(hwlock->owner); | 538 | module_put(hwlock->dev->driver->owner); |
| 539 | 539 | ||
| 540 | out: | 540 | out: |
| 541 | spin_unlock(&hwspinlock_tree_lock); | 541 | spin_unlock(&hwspinlock_tree_lock); |
diff --git a/drivers/hwspinlock/hwspinlock_internal.h b/drivers/hwspinlock/hwspinlock_internal.h index 69935e6b93e5..fb25830c2ee7 100644 --- a/drivers/hwspinlock/hwspinlock_internal.h +++ b/drivers/hwspinlock/hwspinlock_internal.h | |||
| @@ -44,10 +44,9 @@ struct hwspinlock_ops { | |||
| 44 | * @ops: platform-specific hwspinlock handlers | 44 | * @ops: platform-specific hwspinlock handlers |
| 45 | * @id: a global, unique, system-wide, index of the lock. | 45 | * @id: a global, unique, system-wide, index of the lock. |
| 46 | * @lock: initialized and used by hwspinlock core | 46 | * @lock: initialized and used by hwspinlock core |
| 47 | * @owner: underlying implementation module, used to maintain module ref count | ||
| 48 | * | 47 | * |
| 49 | * Note: currently simplicity was opted for, but later we can squeeze some | 48 | * Note: currently simplicity was opted for, but later we can squeeze some |
| 50 | * memory bytes by grouping the dev, ops and owner members in a single | 49 | * memory bytes by grouping dev, ops in a single |
| 51 | * per-platform struct, and have all hwspinlocks point at it. | 50 | * per-platform struct, and have all hwspinlocks point at it. |
| 52 | */ | 51 | */ |
| 53 | struct hwspinlock { | 52 | struct hwspinlock { |
| @@ -55,7 +54,6 @@ struct hwspinlock { | |||
| 55 | const struct hwspinlock_ops *ops; | 54 | const struct hwspinlock_ops *ops; |
| 56 | int id; | 55 | int id; |
| 57 | spinlock_t lock; | 56 | spinlock_t lock; |
| 58 | struct module *owner; | ||
| 59 | }; | 57 | }; |
| 60 | 58 | ||
| 61 | #endif /* __HWSPINLOCK_HWSPINLOCK_H */ | 59 | #endif /* __HWSPINLOCK_HWSPINLOCK_H */ |
diff --git a/drivers/hwspinlock/omap_hwspinlock.c b/drivers/hwspinlock/omap_hwspinlock.c index a8f02734c026..1d19fe9324a4 100644 --- a/drivers/hwspinlock/omap_hwspinlock.c +++ b/drivers/hwspinlock/omap_hwspinlock.c | |||
| @@ -143,7 +143,6 @@ static int __devinit omap_hwspinlock_probe(struct platform_device *pdev) | |||
| 143 | } | 143 | } |
| 144 | 144 | ||
| 145 | omap_lock->lock.dev = &pdev->dev; | 145 | omap_lock->lock.dev = &pdev->dev; |
| 146 | omap_lock->lock.owner = THIS_MODULE; | ||
| 147 | omap_lock->lock.id = i; | 146 | omap_lock->lock.id = i; |
| 148 | omap_lock->lock.ops = &omap_hwspinlock_ops; | 147 | omap_lock->lock.ops = &omap_hwspinlock_ops; |
| 149 | omap_lock->addr = io_base + LOCK_BASE_OFFSET + sizeof(u32) * i; | 148 | omap_lock->addr = io_base + LOCK_BASE_OFFSET + sizeof(u32) * i; |
| @@ -208,6 +207,7 @@ static struct platform_driver omap_hwspinlock_driver = { | |||
| 208 | .remove = omap_hwspinlock_remove, | 207 | .remove = omap_hwspinlock_remove, |
| 209 | .driver = { | 208 | .driver = { |
| 210 | .name = "omap_hwspinlock", | 209 | .name = "omap_hwspinlock", |
| 210 | .owner = THIS_MODULE, | ||
| 211 | }, | 211 | }, |
| 212 | }; | 212 | }; |
| 213 | 213 | ||
