mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2024-12-29 09:13:38 +00:00
c341ac65bf
The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new(), which already returns void. Eventually after all drivers are converted, .remove_new() will be renamed to .remove(). To convert the sprd-sc9860 driver, make sprd_pinctrl_remove() return void (instead of zero) and use .remove_new as callback. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Link: https://lore.kernel.org/r/20231009162510.335208-4-u.kleine-koenig@pengutronix.de Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
60 lines
1.4 KiB
C
60 lines
1.4 KiB
C
/* SPDX-License-Identifier: GPL-2.0-only */
|
|
/*
|
|
* Driver header file for pin controller driver
|
|
* Copyright (C) 2017 Spreadtrum - http://www.spreadtrum.com
|
|
*/
|
|
|
|
#ifndef __PINCTRL_SPRD_H__
|
|
#define __PINCTRL_SPRD_H__
|
|
|
|
struct platform_device;
|
|
|
|
#define NUM_OFFSET (20)
|
|
#define TYPE_OFFSET (16)
|
|
#define BIT_OFFSET (8)
|
|
#define WIDTH_OFFSET (4)
|
|
|
|
#define SPRD_PIN_INFO(num, type, offset, width, reg) \
|
|
(((num) & 0xFFF) << NUM_OFFSET | \
|
|
((type) & 0xF) << TYPE_OFFSET | \
|
|
((offset) & 0xFF) << BIT_OFFSET | \
|
|
((width) & 0xF) << WIDTH_OFFSET | \
|
|
((reg) & 0xF))
|
|
|
|
#define SPRD_PINCTRL_PIN(pin) SPRD_PINCTRL_PIN_DATA(pin, #pin)
|
|
|
|
#define SPRD_PINCTRL_PIN_DATA(a, b) \
|
|
{ \
|
|
.name = b, \
|
|
.num = (((a) >> NUM_OFFSET) & 0xfff), \
|
|
.type = (((a) >> TYPE_OFFSET) & 0xf), \
|
|
.bit_offset = (((a) >> BIT_OFFSET) & 0xff), \
|
|
.bit_width = ((a) >> WIDTH_OFFSET & 0xf), \
|
|
.reg = ((a) & 0xf) \
|
|
}
|
|
|
|
enum pin_type {
|
|
GLOBAL_CTRL_PIN,
|
|
COMMON_PIN,
|
|
MISC_PIN,
|
|
};
|
|
|
|
struct sprd_pins_info {
|
|
const char *name;
|
|
unsigned int num;
|
|
enum pin_type type;
|
|
|
|
/* for global control pins configuration */
|
|
unsigned long bit_offset;
|
|
unsigned long bit_width;
|
|
unsigned int reg;
|
|
};
|
|
|
|
int sprd_pinctrl_core_probe(struct platform_device *pdev,
|
|
struct sprd_pins_info *sprd_soc_pin_info,
|
|
int pins_cnt);
|
|
void sprd_pinctrl_remove(struct platform_device *pdev);
|
|
void sprd_pinctrl_shutdown(struct platform_device *pdev);
|
|
|
|
#endif /* __PINCTRL_SPRD_H__ */
|