diff options
author | Hans-Peter Nilsson <hans-peter.nilsson@axis.com> | 2007-02-12 03:52:45 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-02-12 12:48:31 -0500 |
commit | 0ffa0285052607513a29f529ddb5061c907fd8a6 (patch) | |
tree | d7072494d6d8005c60d42c1c841628c7d486dd9a | |
parent | 7f8c7619ea1ff5ab8e0b08c8120d629834ef4253 (diff) |
[PATCH] SPI cleanup() method param becomes non-const
I'd like to assign NULL to kfree()d members of a structure. I can't do
that without ugly casting (see the PXA patch) when the structure pointed to
is const-qualified. I don't really see a reason why the cleanup method
isn't allowed to alter the object it should clean up. :-)
No, I didn't test the PXA patch, but I verified that the NULL-assignment
doesn't stop me from doing rmmod/insmodding my own spi_bitbang-based
driver.
Signed-off-by: Hans-Peter Nilsson <hp@axis.com>
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r-- | drivers/spi/pxa2xx_spi.c | 4 | ||||
-rw-r--r-- | drivers/spi/spi.c | 2 | ||||
-rw-r--r-- | drivers/spi/spi_bitbang.c | 2 | ||||
-rw-r--r-- | include/linux/spi/spi.h | 2 | ||||
-rw-r--r-- | include/linux/spi/spi_bitbang.h | 2 |
5 files changed, 6 insertions, 6 deletions
diff --git a/drivers/spi/pxa2xx_spi.c b/drivers/spi/pxa2xx_spi.c index 8b41f9cc2560..9f2c887ffa04 100644 --- a/drivers/spi/pxa2xx_spi.c +++ b/drivers/spi/pxa2xx_spi.c | |||
@@ -1214,9 +1214,9 @@ static int setup(struct spi_device *spi) | |||
1214 | return 0; | 1214 | return 0; |
1215 | } | 1215 | } |
1216 | 1216 | ||
1217 | static void cleanup(const struct spi_device *spi) | 1217 | static void cleanup(struct spi_device *spi) |
1218 | { | 1218 | { |
1219 | struct chip_data *chip = spi_get_ctldata((struct spi_device *)spi); | 1219 | struct chip_data *chip = spi_get_ctldata(spi); |
1220 | 1220 | ||
1221 | kfree(chip); | 1221 | kfree(chip); |
1222 | } | 1222 | } |
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c index 6307428d2c94..2328128728be 100644 --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c | |||
@@ -32,7 +32,7 @@ | |||
32 | */ | 32 | */ |
33 | static void spidev_release(struct device *dev) | 33 | static void spidev_release(struct device *dev) |
34 | { | 34 | { |
35 | const struct spi_device *spi = to_spi_device(dev); | 35 | struct spi_device *spi = to_spi_device(dev); |
36 | 36 | ||
37 | /* spi masters may cleanup for released devices */ | 37 | /* spi masters may cleanup for released devices */ |
38 | if (spi->master->cleanup) | 38 | if (spi->master->cleanup) |
diff --git a/drivers/spi/spi_bitbang.c b/drivers/spi/spi_bitbang.c index a5dadc74cee6..24a330d82395 100644 --- a/drivers/spi/spi_bitbang.c +++ b/drivers/spi/spi_bitbang.c | |||
@@ -238,7 +238,7 @@ EXPORT_SYMBOL_GPL(spi_bitbang_setup); | |||
238 | /** | 238 | /** |
239 | * spi_bitbang_cleanup - default cleanup for per-word I/O loops | 239 | * spi_bitbang_cleanup - default cleanup for per-word I/O loops |
240 | */ | 240 | */ |
241 | void spi_bitbang_cleanup(const struct spi_device *spi) | 241 | void spi_bitbang_cleanup(struct spi_device *spi) |
242 | { | 242 | { |
243 | kfree(spi->controller_state); | 243 | kfree(spi->controller_state); |
244 | } | 244 | } |
diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h index 851b25d6e82b..9d8d63109a8f 100644 --- a/include/linux/spi/spi.h +++ b/include/linux/spi/spi.h | |||
@@ -220,7 +220,7 @@ struct spi_master { | |||
220 | struct spi_message *mesg); | 220 | struct spi_message *mesg); |
221 | 221 | ||
222 | /* called on release() to free memory provided by spi_master */ | 222 | /* called on release() to free memory provided by spi_master */ |
223 | void (*cleanup)(const struct spi_device *spi); | 223 | void (*cleanup)(struct spi_device *spi); |
224 | }; | 224 | }; |
225 | 225 | ||
226 | static inline void *spi_master_get_devdata(struct spi_master *master) | 226 | static inline void *spi_master_get_devdata(struct spi_master *master) |
diff --git a/include/linux/spi/spi_bitbang.h b/include/linux/spi/spi_bitbang.h index 16ce178f54d7..2e8c048b9b80 100644 --- a/include/linux/spi/spi_bitbang.h +++ b/include/linux/spi/spi_bitbang.h | |||
@@ -55,7 +55,7 @@ struct spi_bitbang { | |||
55 | * methods, if you like. | 55 | * methods, if you like. |
56 | */ | 56 | */ |
57 | extern int spi_bitbang_setup(struct spi_device *spi); | 57 | extern int spi_bitbang_setup(struct spi_device *spi); |
58 | extern void spi_bitbang_cleanup(const struct spi_device *spi); | 58 | extern void spi_bitbang_cleanup(struct spi_device *spi); |
59 | extern int spi_bitbang_transfer(struct spi_device *spi, struct spi_message *m); | 59 | extern int spi_bitbang_transfer(struct spi_device *spi, struct spi_message *m); |
60 | extern int spi_bitbang_setup_transfer(struct spi_device *spi, | 60 | extern int spi_bitbang_setup_transfer(struct spi_device *spi, |
61 | struct spi_transfer *t); | 61 | struct spi_transfer *t); |