diff options
author | Julia Lawall <Julia.Lawall@lip6.fr> | 2018-06-13 00:48:09 -0400 |
---|---|---|
committer | Lee Jones <lee.jones@linaro.org> | 2018-07-27 03:13:24 -0400 |
commit | bf1cafa18be3b73ad30a3bbf2c3dae5ef333189a (patch) | |
tree | 629304e63d98e9f81295a89675d373ead535a2c7 | |
parent | e5ff19cf75f33a4654fc54631577146a1162d527 (diff) |
mfd: kempld-core: Constify variables that point to const structure
Add const to the declaration of various local variables of type
kempld_platform_data for which the referenced value is always only
dereferenced or passed to a const parameter, to record the fact that
kempld_platform_data_generic is declared as const.
The semantic match that finds this issue is as follows:
(http://coccinelle.lip6.fr/)
// <smpl>
@r@
identifier i,j;
@@
const struct i j = { ... };
@ok@
identifier r.i;
position p;
@@
const struct i@p *
@@
identifier r.i;
position p != ok.p;
@@
* struct i@p *
// </smpl>
Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
-rw-r--r-- | drivers/mfd/kempld-core.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/drivers/mfd/kempld-core.c b/drivers/mfd/kempld-core.c index 390b27cb2c2e..fb5a10b8317d 100644 --- a/drivers/mfd/kempld-core.c +++ b/drivers/mfd/kempld-core.c | |||
@@ -143,7 +143,7 @@ static struct platform_device *kempld_pdev; | |||
143 | 143 | ||
144 | static int kempld_create_platform_device(const struct dmi_system_id *id) | 144 | static int kempld_create_platform_device(const struct dmi_system_id *id) |
145 | { | 145 | { |
146 | struct kempld_platform_data *pdata = id->driver_data; | 146 | const struct kempld_platform_data *pdata = id->driver_data; |
147 | int ret; | 147 | int ret; |
148 | 148 | ||
149 | kempld_pdev = platform_device_alloc("kempld", -1); | 149 | kempld_pdev = platform_device_alloc("kempld", -1); |
@@ -259,7 +259,7 @@ EXPORT_SYMBOL_GPL(kempld_write32); | |||
259 | */ | 259 | */ |
260 | void kempld_get_mutex(struct kempld_device_data *pld) | 260 | void kempld_get_mutex(struct kempld_device_data *pld) |
261 | { | 261 | { |
262 | struct kempld_platform_data *pdata = dev_get_platdata(pld->dev); | 262 | const struct kempld_platform_data *pdata = dev_get_platdata(pld->dev); |
263 | 263 | ||
264 | mutex_lock(&pld->lock); | 264 | mutex_lock(&pld->lock); |
265 | pdata->get_hardware_mutex(pld); | 265 | pdata->get_hardware_mutex(pld); |
@@ -272,7 +272,7 @@ EXPORT_SYMBOL_GPL(kempld_get_mutex); | |||
272 | */ | 272 | */ |
273 | void kempld_release_mutex(struct kempld_device_data *pld) | 273 | void kempld_release_mutex(struct kempld_device_data *pld) |
274 | { | 274 | { |
275 | struct kempld_platform_data *pdata = dev_get_platdata(pld->dev); | 275 | const struct kempld_platform_data *pdata = dev_get_platdata(pld->dev); |
276 | 276 | ||
277 | pdata->release_hardware_mutex(pld); | 277 | pdata->release_hardware_mutex(pld); |
278 | mutex_unlock(&pld->lock); | 278 | mutex_unlock(&pld->lock); |
@@ -290,7 +290,7 @@ EXPORT_SYMBOL_GPL(kempld_release_mutex); | |||
290 | static int kempld_get_info(struct kempld_device_data *pld) | 290 | static int kempld_get_info(struct kempld_device_data *pld) |
291 | { | 291 | { |
292 | int ret; | 292 | int ret; |
293 | struct kempld_platform_data *pdata = dev_get_platdata(pld->dev); | 293 | const struct kempld_platform_data *pdata = dev_get_platdata(pld->dev); |
294 | char major, minor; | 294 | char major, minor; |
295 | 295 | ||
296 | ret = pdata->get_info(pld); | 296 | ret = pdata->get_info(pld); |
@@ -332,7 +332,7 @@ static int kempld_get_info(struct kempld_device_data *pld) | |||
332 | */ | 332 | */ |
333 | static int kempld_register_cells(struct kempld_device_data *pld) | 333 | static int kempld_register_cells(struct kempld_device_data *pld) |
334 | { | 334 | { |
335 | struct kempld_platform_data *pdata = dev_get_platdata(pld->dev); | 335 | const struct kempld_platform_data *pdata = dev_get_platdata(pld->dev); |
336 | 336 | ||
337 | return pdata->register_cells(pld); | 337 | return pdata->register_cells(pld); |
338 | } | 338 | } |
@@ -444,7 +444,8 @@ static int kempld_detect_device(struct kempld_device_data *pld) | |||
444 | 444 | ||
445 | static int kempld_probe(struct platform_device *pdev) | 445 | static int kempld_probe(struct platform_device *pdev) |
446 | { | 446 | { |
447 | struct kempld_platform_data *pdata = dev_get_platdata(&pdev->dev); | 447 | const struct kempld_platform_data *pdata = |
448 | dev_get_platdata(&pdev->dev); | ||
448 | struct device *dev = &pdev->dev; | 449 | struct device *dev = &pdev->dev; |
449 | struct kempld_device_data *pld; | 450 | struct kempld_device_data *pld; |
450 | struct resource *ioport; | 451 | struct resource *ioport; |
@@ -476,7 +477,7 @@ static int kempld_probe(struct platform_device *pdev) | |||
476 | static int kempld_remove(struct platform_device *pdev) | 477 | static int kempld_remove(struct platform_device *pdev) |
477 | { | 478 | { |
478 | struct kempld_device_data *pld = platform_get_drvdata(pdev); | 479 | struct kempld_device_data *pld = platform_get_drvdata(pdev); |
479 | struct kempld_platform_data *pdata = dev_get_platdata(pld->dev); | 480 | const struct kempld_platform_data *pdata = dev_get_platdata(pld->dev); |
480 | 481 | ||
481 | sysfs_remove_group(&pld->dev->kobj, &pld_attr_group); | 482 | sysfs_remove_group(&pld->dev->kobj, &pld_attr_group); |
482 | 483 | ||