mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-01-12 01:20:14 +00:00
This concerns a crash in the Qualcomm pin controller GPIO
portions when using hogs. First patch hits into the gpiolib making gpiochip_line_is_valid() NULL-tolerant. Second patch fixes the actual problem. -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEElDRnuGcz/wPCXQWMQRCzN7AZXXMFAmgu4YIACgkQQRCzN7AZ XXPjKw/+JsvFeihW6JedAcfeV0NvUzra80cx9ArJMul48v+CR+vpZr0XsdDzH7tn 19zNqi5jA57uzGruuoI+KR8BxXHYS3bUuzy68zpHgKy4UzJ5pt0ehm3ArbGcA0Nq 7MCUs9WP3BuOWfwrb1bdeWbFlk9ApO8drqrREmcnZrJRPSBwjG9lkNZwrDz1pUaQ Nj/45cq2LQiXY52y2znovDQsnhD6omECeT0hbZ33pNyjmr+cWyIHlZXWrDSADHF8 nLGgFx/8NpIkBE9vx3+Ch5iHyAO9qCrEFmsaOMJlqIme5eYBuu8noJQUrGVAYRVT HA9bsIzDO6ko2ZhWpzr3/0tiJ7IlRPHy9C/9BNnDaH1STwhEtpnBCJkaEiXxb8JD oNY9b9NDn3VN8lHMlxjDSryYsgrlcyJ9m6G4SHqa62UHvwp4osScb24Y03O4wxTz xSuokmeO2KGHiEdZwHrObrAYSBBxMAq4aENehZbLxy5GswAawhiwJcIoWez9AyNA xWkkKwX+YPlB8yFGJREHcON07dhnGHU99HBavYj+RBGeZFl2U7f22s7u8MnM+3Ul 7kAWwRjwLVTEPTWbAQ7W+GLSAShwkPGSEqZEKvPLXGh9Bg6+UjEx2NCa02Kicpi9 l5+2rL/xZw10vHFZnXuwwD2wzMe2mgc5VRZFquOXror18exM744= =EGi8 -----END PGP SIGNATURE----- Merge tag 'pinctrl-v6.15-4' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl Pull pin control fixes from Linus Walleij: "This deals with a crash in the Qualcomm pin controller GPIO parts when using hogs. The first patch to gpiolib makes gpiochip_line_is_valid() NULL-tolerant. The second patch fixes the actual problem" * tag 'pinctrl-v6.15-4' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl: pinctrl: qcom: switch to devm_register_sys_off_handler() gpiolib: don't crash on enabling GPIO HOG pins
This commit is contained in:
commit
b1819ae85e
@ -742,6 +742,12 @@ EXPORT_SYMBOL_GPL(gpiochip_query_valid_mask);
|
||||
bool gpiochip_line_is_valid(const struct gpio_chip *gc,
|
||||
unsigned int offset)
|
||||
{
|
||||
/*
|
||||
* hog pins are requested before registering GPIO chip
|
||||
*/
|
||||
if (!gc->gpiodev)
|
||||
return true;
|
||||
|
||||
/* No mask means all valid */
|
||||
if (likely(!gc->gpiodev->valid_mask))
|
||||
return true;
|
||||
|
||||
@ -44,7 +44,6 @@
|
||||
* @pctrl: pinctrl handle.
|
||||
* @chip: gpiochip handle.
|
||||
* @desc: pin controller descriptor
|
||||
* @restart_nb: restart notifier block.
|
||||
* @irq: parent irq for the TLMM irq_chip.
|
||||
* @intr_target_use_scm: route irq to application cpu using scm calls
|
||||
* @lock: Spinlock to protect register resources as well
|
||||
@ -64,7 +63,6 @@ struct msm_pinctrl {
|
||||
struct pinctrl_dev *pctrl;
|
||||
struct gpio_chip chip;
|
||||
struct pinctrl_desc desc;
|
||||
struct notifier_block restart_nb;
|
||||
|
||||
int irq;
|
||||
|
||||
@ -1471,10 +1469,9 @@ static int msm_gpio_init(struct msm_pinctrl *pctrl)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int msm_ps_hold_restart(struct notifier_block *nb, unsigned long action,
|
||||
void *data)
|
||||
static int msm_ps_hold_restart(struct sys_off_data *data)
|
||||
{
|
||||
struct msm_pinctrl *pctrl = container_of(nb, struct msm_pinctrl, restart_nb);
|
||||
struct msm_pinctrl *pctrl = data->cb_data;
|
||||
|
||||
writel(0, pctrl->regs[0] + PS_HOLD_OFFSET);
|
||||
mdelay(1000);
|
||||
@ -1485,7 +1482,11 @@ static struct msm_pinctrl *poweroff_pctrl;
|
||||
|
||||
static void msm_ps_hold_poweroff(void)
|
||||
{
|
||||
msm_ps_hold_restart(&poweroff_pctrl->restart_nb, 0, NULL);
|
||||
struct sys_off_data data = {
|
||||
.cb_data = poweroff_pctrl,
|
||||
};
|
||||
|
||||
msm_ps_hold_restart(&data);
|
||||
}
|
||||
|
||||
static void msm_pinctrl_setup_pm_reset(struct msm_pinctrl *pctrl)
|
||||
@ -1495,9 +1496,11 @@ static void msm_pinctrl_setup_pm_reset(struct msm_pinctrl *pctrl)
|
||||
|
||||
for (i = 0; i < pctrl->soc->nfunctions; i++)
|
||||
if (!strcmp(func[i].name, "ps_hold")) {
|
||||
pctrl->restart_nb.notifier_call = msm_ps_hold_restart;
|
||||
pctrl->restart_nb.priority = 128;
|
||||
if (register_restart_handler(&pctrl->restart_nb))
|
||||
if (devm_register_sys_off_handler(pctrl->dev,
|
||||
SYS_OFF_MODE_RESTART,
|
||||
128,
|
||||
msm_ps_hold_restart,
|
||||
pctrl))
|
||||
dev_err(pctrl->dev,
|
||||
"failed to setup restart handler.\n");
|
||||
poweroff_pctrl = pctrl;
|
||||
@ -1599,8 +1602,6 @@ void msm_pinctrl_remove(struct platform_device *pdev)
|
||||
struct msm_pinctrl *pctrl = platform_get_drvdata(pdev);
|
||||
|
||||
gpiochip_remove(&pctrl->chip);
|
||||
|
||||
unregister_restart_handler(&pctrl->restart_nb);
|
||||
}
|
||||
EXPORT_SYMBOL(msm_pinctrl_remove);
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user