mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-30 19:51:31 -04:00
[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 <[email protected]> Signed-off-by: David Brownell <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
parent
7f8c7619ea
commit
0ffa028505
5 changed files with 6 additions and 6 deletions
|
|
@ -1214,9 +1214,9 @@ static int setup(struct spi_device *spi)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static void cleanup(const struct spi_device *spi)
|
||||
static void cleanup(struct spi_device *spi)
|
||||
{
|
||||
struct chip_data *chip = spi_get_ctldata((struct spi_device *)spi);
|
||||
struct chip_data *chip = spi_get_ctldata(spi);
|
||||
|
||||
kfree(chip);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@
|
|||
*/
|
||||
static void spidev_release(struct device *dev)
|
||||
{
|
||||
const struct spi_device *spi = to_spi_device(dev);
|
||||
struct spi_device *spi = to_spi_device(dev);
|
||||
|
||||
/* spi masters may cleanup for released devices */
|
||||
if (spi->master->cleanup)
|
||||
|
|
|
|||
|
|
@ -238,7 +238,7 @@ EXPORT_SYMBOL_GPL(spi_bitbang_setup);
|
|||
/**
|
||||
* spi_bitbang_cleanup - default cleanup for per-word I/O loops
|
||||
*/
|
||||
void spi_bitbang_cleanup(const struct spi_device *spi)
|
||||
void spi_bitbang_cleanup(struct spi_device *spi)
|
||||
{
|
||||
kfree(spi->controller_state);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue