Message ID | 20230731083806.453036-2-hch@lst.de (mailing list archive) |
---|---|
State | Not Applicable |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | [1/5] ARM/pxa: use EXPORT_SYMBOL_GPL for sharpsl_battery_kick | expand |
On Mon, Jul 31, 2023, at 10:38, Christoph Hellwig wrote: > sharpsl_battery_kick is only used via symbol_get, which was only ever > intended for very internal symbols like this one. Use EXPORT_SYMBOL_GPL > for it so that symbol_get can enforce only being used on > EXPORT_SYMBOL_GPL symbols. > > Signed-off-by: Christoph Hellwig <hch@lst.de> The reasoning makes sense, and the patch looks good, so feel free to take this through your tree. Acked-by: Arnd Bergmann <arnd@arndb.de> Or let me know if you want a better fix. Since sharpsl_pm.c and spitz.c are no longer loadable modules and just get linked together these days, I think the variant below would be simpler (this could be cleanup up further, endlessly, of course): --- a/arch/arm/mach-pxa/spitz.c +++ b/arch/arm/mach-pxa/spitz.c @@ -518,17 +518,6 @@ static struct gpiod_lookup_table spitz_ads7846_gpio_table = { }, }; -static void spitz_bl_kick_battery(void) -{ - void (*kick_batt)(void); - - kick_batt = symbol_get(sharpsl_battery_kick); - if (kick_batt) { - kick_batt(); - symbol_put(sharpsl_battery_kick); - } -} - static struct gpiod_lookup_table spitz_lcdcon_gpio_table = { .dev_id = "spi2.1", .table = { @@ -556,7 +545,7 @@ static struct corgi_lcd_platform_data spitz_lcdcon_info = { .max_intensity = 0x2f, .default_intensity = 0x1f, .limit_mask = 0x0b, - .kick_battery = spitz_bl_kick_battery, + .kick_battery = sharpsl_battery_kick, }; static struct spi_board_info spitz_spi_devices[] = {
On Mon, Jul 31, 2023 at 06:12:22PM +0200, Arnd Bergmann wrote: > Or let me know if you want a better fix. Since sharpsl_pm.c and > spitz.c are no longer loadable modules and just get linked together > these days, I think the variant below would be simpler (this could > be cleanup up further, endlessly, of course): That actually looks way nicer, thanks! If you give me a singoff I'll add it to the next version.
diff --git a/arch/arm/mach-pxa/sharpsl_pm.c b/arch/arm/mach-pxa/sharpsl_pm.c index d29bdcd5270e0f..08eec58632c988 100644 --- a/arch/arm/mach-pxa/sharpsl_pm.c +++ b/arch/arm/mach-pxa/sharpsl_pm.c @@ -216,7 +216,7 @@ void sharpsl_battery_kick(void) { schedule_delayed_work(&sharpsl_bat, msecs_to_jiffies(125)); } -EXPORT_SYMBOL(sharpsl_battery_kick); +EXPORT_SYMBOL_GPL(sharpsl_battery_kick); static void sharpsl_battery_thread(struct work_struct *private_)
sharpsl_battery_kick is only used via symbol_get, which was only ever intended for very internal symbols like this one. Use EXPORT_SYMBOL_GPL for it so that symbol_get can enforce only being used on EXPORT_SYMBOL_GPL symbols. Signed-off-by: Christoph Hellwig <hch@lst.de> --- arch/arm/mach-pxa/sharpsl_pm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)