From patchwork Sat Dec 12 10:57:08 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 342867 Delivered-To: patch@linaro.org Received: by 2002:a02:85a7:0:0:0:0:0 with SMTP id d36csp1348688jai; Sat, 12 Dec 2020 02:59:20 -0800 (PST) X-Google-Smtp-Source: ABdhPJyWliRJKOx7ZVRtdHcHHHllyuTbwG+QBdM55U9XbgoEb4alQpmr4+c5HTmUjhPifZJJgd79 X-Received: by 2002:a17:907:1607:: with SMTP id hb7mr14284896ejc.81.1607770759831; Sat, 12 Dec 2020 02:59:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607770759; cv=none; d=google.com; s=arc-20160816; b=Dyg8ldnTc/10fFQ2RxIvfSvez90kHMW/3U2BH2Akd0h0ZjNhKptpDC9vCHCRUKW8eR ba9wclKLCoEiJGYi25kSALyOVz4o8k/SCjZVOCtPCUPtuqWyHz3EtECLFrIkbMgOKyiO q3HHnXd8Bza8KDKnLSXscBVfKDkg95aiGE5B8RKpTvEETUhDkreGyCIQLAfNpCh/jNL4 Zq1ncy58N3AP8/XaaC+0jyQFNtEUohmUjfunGrjA//Tj7x8hMNEHSL3IzZMRyCQeYcSX 11UH4U++K321mXJ37afpEDBfaV34YBp/sLDcZbEHbdSbBm4hk4l1/jaUYevQOV0nKGf5 Kcog== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=X8VThf45bOLdUfUXFvslCbuQWhXnY7v/1IVWJ78UmWc=; b=D2tH9xDrBCqt5N6X5Y/3HBsUDLoi7O8ksm+i2atTGtVA79f93u9x9s/ysaBeXb2VWT MLsbDErmQsaR5nxO3TeXrwYg5CaqLIgnIIglfxDc1HuaJVxKbO86UnRikNeYLkw8fL4G WyjX7J6Jcy1yr3CqL8Ew7VPv5vDBBZVb8qpl0JX53/H0lUNzewGo7UVthXd9YmEyA1vj AiSBtD3pl8fduolEIJ0MwC0NjpOwjKaDaSWqLS6ad2Se0uEY9sVQS9pKDNuUcaHCgUd2 1CVXagBLFsWsvWEY3wpsRQsL8xUjNmOveO3BYFClomA6C96U32tf+2nmNR4IXRI2/Jfi gP7g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ne3thSHB; spf=pass (google.com: domain of linux-pm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-pm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dp1si6354112ejc.21.2020.12.12.02.59.19; Sat, 12 Dec 2020 02:59:19 -0800 (PST) Received-SPF: pass (google.com: domain of linux-pm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ne3thSHB; spf=pass (google.com: domain of linux-pm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-pm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2438855AbgLLK6F (ORCPT + 8 others); Sat, 12 Dec 2020 05:58:05 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51442 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2438848AbgLLK6D (ORCPT ); Sat, 12 Dec 2020 05:58:03 -0500 Received: from mail-lf1-x141.google.com (mail-lf1-x141.google.com [IPv6:2a00:1450:4864:20::141]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5DBCCC0613D6 for ; Sat, 12 Dec 2020 02:57:22 -0800 (PST) Received: by mail-lf1-x141.google.com with SMTP id m19so17994709lfb.1 for ; Sat, 12 Dec 2020 02:57:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=X8VThf45bOLdUfUXFvslCbuQWhXnY7v/1IVWJ78UmWc=; b=ne3thSHBZBhX1g1mHi0LhgwhidmJx7TsLVTJ7y6e7x9g0FgZ+ne2qrc4G7yIT25R15 6HhVjm2sJiZrz20ziTN4nqNU18iuHihwVX5TKQ178wBA0tvKozjRdjq8A0tlBWTLxcSc N8a54K+ZTDSaMgN0BXTKlAPbFh4oJC3L61mzeyiZ+FFHSgA/oG94Vo6eCxflE5sWfAZI 7V/bhW77f8vwHSeVGFeQtWccpf+HacfOa818zqdZUSwRBqZ1G1FC7uXfgrCtQz8oRifK 4SBIteoJXROU/mAE7ftSpbijVh8vwCQrQRxT9bQqm887aWwxE4WSSZJGYxbLGlgnWhE6 oZaQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=X8VThf45bOLdUfUXFvslCbuQWhXnY7v/1IVWJ78UmWc=; b=KN0hDTaoHBJQmO2sBlNvcnEnMTxh4z/cOnf6yFSbUx5bXmQql+CtPWxSoQ0e+mAP7C u4E2gwQQMuJcOnTzgohPRn3i1EPNbofYuDHPfXqDOePwLOZoNqRi+zBi6c7xvy5RzPzb 7CXJPmcY+A2wdzZNZAaGRBEweGt41towHLCh0HPJS0dY9dMTdjo9v6Ak7Ux+Q9RwUJpL HmH3unt3csBqiJIJBTaxIRce/66fEtMoaVh2e/jby2LbvustxQoKbwmK7yxpiT0PAd5l SMe8VaEI5fTnq2MNQciWJUX+bF4W/Zxixp7sDAXoCsUjJ2yVS5K+42V8kYzBGxALXngY nv/w== X-Gm-Message-State: AOAM531PKxIDO91dBc7I30JjCjvoyxfzgnQ5zgLCDAbTonI1j2n2YFna eCQ96KHGDSky+yBnOslAB35kyA== X-Received: by 2002:a2e:7803:: with SMTP id t3mr4611043ljc.213.1607770640749; Sat, 12 Dec 2020 02:57:20 -0800 (PST) Received: from localhost.bredbandsbolaget (c-92d7225c.014-348-6c756e10.bbcust.telenor.se. [92.34.215.146]) by smtp.gmail.com with ESMTPSA id j2sm490674lfe.213.2020.12.12.02.57.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 12 Dec 2020 02:57:20 -0800 (PST) From: Linus Walleij To: Sebastian Reichel , Marcus Cooper Cc: linux-pm@vger.kernel.org, Linus Walleij Subject: [PATCH 1/5] power: supply: ab8500: Use local helper Date: Sat, 12 Dec 2020 11:57:08 +0100 Message-Id: <20201212105712.2727842-2-linus.walleij@linaro.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20201212105712.2727842-1-linus.walleij@linaro.org> References: <20201212105712.2727842-1-linus.walleij@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org Use a local "dev" helper variable to make the probe() code easier to read in the ab8500 subdrivers. Drop out-of-memory messages as these should come from the slab core. Cc: Marcus Cooper Signed-off-by: Linus Walleij --- drivers/power/supply/ab8500_btemp.c | 37 +++++++++--------- drivers/power/supply/ab8500_charger.c | 55 +++++++++++++-------------- drivers/power/supply/ab8500_fg.c | 39 +++++++++---------- 3 files changed, 64 insertions(+), 67 deletions(-) -- 2.26.2 diff --git a/drivers/power/supply/ab8500_btemp.c b/drivers/power/supply/ab8500_btemp.c index 909f0242bacb..06b4247ebc45 100644 --- a/drivers/power/supply/ab8500_btemp.c +++ b/drivers/power/supply/ab8500_btemp.c @@ -999,47 +999,46 @@ static int ab8500_btemp_probe(struct platform_device *pdev) struct device_node *np = pdev->dev.of_node; struct abx500_bm_data *plat = pdev->dev.platform_data; struct power_supply_config psy_cfg = {}; + struct device *dev = &pdev->dev; struct ab8500_btemp *di; int irq, i, ret = 0; u8 val; - di = devm_kzalloc(&pdev->dev, sizeof(*di), GFP_KERNEL); - if (!di) { - dev_err(&pdev->dev, "%s no mem for ab8500_btemp\n", __func__); + di = devm_kzalloc(dev, sizeof(*di), GFP_KERNEL); + if (!di) return -ENOMEM; - } if (!plat) { - dev_err(&pdev->dev, "no battery management data supplied\n"); + dev_err(dev, "no battery management data supplied\n"); return -EINVAL; } di->bm = plat; if (np) { - ret = ab8500_bm_of_probe(&pdev->dev, np, di->bm); + ret = ab8500_bm_of_probe(dev, np, di->bm); if (ret) { - dev_err(&pdev->dev, "failed to get battery information\n"); + dev_err(dev, "failed to get battery information\n"); return ret; } } /* get parent data */ - di->dev = &pdev->dev; + di->dev = dev; di->parent = dev_get_drvdata(pdev->dev.parent); /* Get ADC channels */ - di->btemp_ball = devm_iio_channel_get(&pdev->dev, "btemp_ball"); + di->btemp_ball = devm_iio_channel_get(dev, "btemp_ball"); if (IS_ERR(di->btemp_ball)) { if (PTR_ERR(di->btemp_ball) == -ENODEV) return -EPROBE_DEFER; - dev_err(&pdev->dev, "failed to get BTEMP BALL ADC channel\n"); + dev_err(dev, "failed to get BTEMP BALL ADC channel\n"); return PTR_ERR(di->btemp_ball); } - di->bat_ctrl = devm_iio_channel_get(&pdev->dev, "bat_ctrl"); + di->bat_ctrl = devm_iio_channel_get(dev, "bat_ctrl"); if (IS_ERR(di->bat_ctrl)) { if (PTR_ERR(di->bat_ctrl) == -ENODEV) return -EPROBE_DEFER; - dev_err(&pdev->dev, "failed to get BAT CTRL ADC channel\n"); + dev_err(dev, "failed to get BAT CTRL ADC channel\n"); return PTR_ERR(di->bat_ctrl); } @@ -1053,7 +1052,7 @@ static int ab8500_btemp_probe(struct platform_device *pdev) di->btemp_wq = alloc_workqueue("ab8500_btemp_wq", WQ_MEM_RECLAIM, 0); if (di->btemp_wq == NULL) { - dev_err(di->dev, "failed to create work queue\n"); + dev_err(dev, "failed to create work queue\n"); return -ENOMEM; } @@ -1065,10 +1064,10 @@ static int ab8500_btemp_probe(struct platform_device *pdev) di->btemp_ranges.btemp_low_limit = BTEMP_THERMAL_LOW_LIMIT; di->btemp_ranges.btemp_med_limit = BTEMP_THERMAL_MED_LIMIT; - ret = abx500_get_register_interruptible(di->dev, AB8500_CHARGER, + ret = abx500_get_register_interruptible(dev, AB8500_CHARGER, AB8500_BTEMP_HIGH_TH, &val); if (ret < 0) { - dev_err(di->dev, "%s ab8500 read failed\n", __func__); + dev_err(dev, "%s ab8500 read failed\n", __func__); goto free_btemp_wq; } switch (val) { @@ -1088,10 +1087,10 @@ static int ab8500_btemp_probe(struct platform_device *pdev) } /* Register BTEMP power supply class */ - di->btemp_psy = power_supply_register(di->dev, &ab8500_btemp_desc, + di->btemp_psy = power_supply_register(dev, &ab8500_btemp_desc, &psy_cfg); if (IS_ERR(di->btemp_psy)) { - dev_err(di->dev, "failed to register BTEMP psy\n"); + dev_err(dev, "failed to register BTEMP psy\n"); ret = PTR_ERR(di->btemp_psy); goto free_btemp_wq; } @@ -1109,11 +1108,11 @@ static int ab8500_btemp_probe(struct platform_device *pdev) ab8500_btemp_irq[i].name, di); if (ret) { - dev_err(di->dev, "failed to request %s IRQ %d: %d\n" + dev_err(dev, "failed to request %s IRQ %d: %d\n" , ab8500_btemp_irq[i].name, irq, ret); goto free_irq; } - dev_dbg(di->dev, "Requested %s IRQ %d: %d\n", + dev_dbg(dev, "Requested %s IRQ %d: %d\n", ab8500_btemp_irq[i].name, irq, ret); } diff --git a/drivers/power/supply/ab8500_charger.c b/drivers/power/supply/ab8500_charger.c index db65be026920..7e28ac1b171b 100644 --- a/drivers/power/supply/ab8500_charger.c +++ b/drivers/power/supply/ab8500_charger.c @@ -3354,23 +3354,22 @@ static int ab8500_charger_probe(struct platform_device *pdev) struct power_supply_config ac_psy_cfg = {}, usb_psy_cfg = {}; struct ab8500_charger *di; int irq, i, charger_status, ret = 0, ch_stat; + struct device *dev = &pdev->dev; - di = devm_kzalloc(&pdev->dev, sizeof(*di), GFP_KERNEL); - if (!di) { - dev_err(&pdev->dev, "%s no mem for ab8500_charger\n", __func__); + di = devm_kzalloc(dev, sizeof(*di), GFP_KERNEL); + if (!di) return -ENOMEM; - } if (!plat) { - dev_err(&pdev->dev, "no battery management data supplied\n"); + dev_err(dev, "no battery management data supplied\n"); return -EINVAL; } di->bm = plat; if (np) { - ret = ab8500_bm_of_probe(&pdev->dev, np, di->bm); + ret = ab8500_bm_of_probe(dev, np, di->bm); if (ret) { - dev_err(&pdev->dev, "failed to get battery information\n"); + dev_err(dev, "failed to get battery information\n"); return ret; } di->autopower_cfg = of_property_read_bool(np, "autopower_cfg"); @@ -3378,39 +3377,39 @@ static int ab8500_charger_probe(struct platform_device *pdev) di->autopower_cfg = false; /* get parent data */ - di->dev = &pdev->dev; + di->dev = dev; di->parent = dev_get_drvdata(pdev->dev.parent); /* Get ADC channels */ - di->adc_main_charger_v = devm_iio_channel_get(&pdev->dev, + di->adc_main_charger_v = devm_iio_channel_get(dev, "main_charger_v"); if (IS_ERR(di->adc_main_charger_v)) { if (PTR_ERR(di->adc_main_charger_v) == -ENODEV) return -EPROBE_DEFER; - dev_err(&pdev->dev, "failed to get ADC main charger voltage\n"); + dev_err(dev, "failed to get ADC main charger voltage\n"); return PTR_ERR(di->adc_main_charger_v); } - di->adc_main_charger_c = devm_iio_channel_get(&pdev->dev, + di->adc_main_charger_c = devm_iio_channel_get(dev, "main_charger_c"); if (IS_ERR(di->adc_main_charger_c)) { if (PTR_ERR(di->adc_main_charger_c) == -ENODEV) return -EPROBE_DEFER; - dev_err(&pdev->dev, "failed to get ADC main charger current\n"); + dev_err(dev, "failed to get ADC main charger current\n"); return PTR_ERR(di->adc_main_charger_c); } - di->adc_vbus_v = devm_iio_channel_get(&pdev->dev, "vbus_v"); + di->adc_vbus_v = devm_iio_channel_get(dev, "vbus_v"); if (IS_ERR(di->adc_vbus_v)) { if (PTR_ERR(di->adc_vbus_v) == -ENODEV) return -EPROBE_DEFER; - dev_err(&pdev->dev, "failed to get ADC USB charger voltage\n"); + dev_err(dev, "failed to get ADC USB charger voltage\n"); return PTR_ERR(di->adc_vbus_v); } - di->adc_usb_charger_c = devm_iio_channel_get(&pdev->dev, + di->adc_usb_charger_c = devm_iio_channel_get(dev, "usb_charger_c"); if (IS_ERR(di->adc_usb_charger_c)) { if (PTR_ERR(di->adc_usb_charger_c) == -ENODEV) return -EPROBE_DEFER; - dev_err(&pdev->dev, "failed to get ADC USB charger current\n"); + dev_err(dev, "failed to get ADC USB charger current\n"); return PTR_ERR(di->adc_usb_charger_c); } @@ -3467,7 +3466,7 @@ static int ab8500_charger_probe(struct platform_device *pdev) di->charger_wq = alloc_ordered_workqueue("ab8500_charger_wq", WQ_MEM_RECLAIM); if (di->charger_wq == NULL) { - dev_err(di->dev, "failed to create work queue\n"); + dev_err(dev, "failed to create work queue\n"); return -ENOMEM; } @@ -3526,10 +3525,10 @@ static int ab8500_charger_probe(struct platform_device *pdev) * is a charger connected to avoid erroneous BTEMP_HIGH/LOW * interrupts during charging */ - di->regu = devm_regulator_get(di->dev, "vddadc"); + di->regu = devm_regulator_get(dev, "vddadc"); if (IS_ERR(di->regu)) { ret = PTR_ERR(di->regu); - dev_err(di->dev, "failed to get vddadc regulator\n"); + dev_err(dev, "failed to get vddadc regulator\n"); goto free_charger_wq; } @@ -3537,17 +3536,17 @@ static int ab8500_charger_probe(struct platform_device *pdev) /* Initialize OVV, and other registers */ ret = ab8500_charger_init_hw_registers(di); if (ret) { - dev_err(di->dev, "failed to initialize ABB registers\n"); + dev_err(dev, "failed to initialize ABB registers\n"); goto free_charger_wq; } /* Register AC charger class */ if (di->ac_chg.enabled) { - di->ac_chg.psy = power_supply_register(di->dev, + di->ac_chg.psy = power_supply_register(dev, &ab8500_ac_chg_desc, &ac_psy_cfg); if (IS_ERR(di->ac_chg.psy)) { - dev_err(di->dev, "failed to register AC charger\n"); + dev_err(dev, "failed to register AC charger\n"); ret = PTR_ERR(di->ac_chg.psy); goto free_charger_wq; } @@ -3555,11 +3554,11 @@ static int ab8500_charger_probe(struct platform_device *pdev) /* Register USB charger class */ if (di->usb_chg.enabled) { - di->usb_chg.psy = power_supply_register(di->dev, + di->usb_chg.psy = power_supply_register(dev, &ab8500_usb_chg_desc, &usb_psy_cfg); if (IS_ERR(di->usb_chg.psy)) { - dev_err(di->dev, "failed to register USB charger\n"); + dev_err(dev, "failed to register USB charger\n"); ret = PTR_ERR(di->usb_chg.psy); goto free_ac; } @@ -3567,14 +3566,14 @@ static int ab8500_charger_probe(struct platform_device *pdev) di->usb_phy = usb_get_phy(USB_PHY_TYPE_USB2); if (IS_ERR_OR_NULL(di->usb_phy)) { - dev_err(di->dev, "failed to get usb transceiver\n"); + dev_err(dev, "failed to get usb transceiver\n"); ret = -EINVAL; goto free_usb; } di->nb.notifier_call = ab8500_charger_usb_notifier_call; ret = usb_register_notifier(di->usb_phy, &di->nb); if (ret) { - dev_err(di->dev, "failed to register usb notifier\n"); + dev_err(dev, "failed to register usb notifier\n"); goto put_usb_phy; } @@ -3607,11 +3606,11 @@ static int ab8500_charger_probe(struct platform_device *pdev) ab8500_charger_irq[i].name, di); if (ret != 0) { - dev_err(di->dev, "failed to request %s IRQ %d: %d\n" + dev_err(dev, "failed to request %s IRQ %d: %d\n" , ab8500_charger_irq[i].name, irq, ret); goto free_irq; } - dev_dbg(di->dev, "Requested %s IRQ %d: %d\n", + dev_dbg(dev, "Requested %s IRQ %d: %d\n", ab8500_charger_irq[i].name, irq, ret); } diff --git a/drivers/power/supply/ab8500_fg.c b/drivers/power/supply/ab8500_fg.c index 592a73d4dde6..56997353c175 100644 --- a/drivers/power/supply/ab8500_fg.c +++ b/drivers/power/supply/ab8500_fg.c @@ -3037,26 +3037,25 @@ static int ab8500_fg_probe(struct platform_device *pdev) struct device_node *np = pdev->dev.of_node; struct abx500_bm_data *plat = pdev->dev.platform_data; struct power_supply_config psy_cfg = {}; + struct device *dev = &pdev->dev; struct ab8500_fg *di; int i, irq; int ret = 0; - di = devm_kzalloc(&pdev->dev, sizeof(*di), GFP_KERNEL); - if (!di) { - dev_err(&pdev->dev, "%s no mem for ab8500_fg\n", __func__); + di = devm_kzalloc(dev, sizeof(*di), GFP_KERNEL); + if (!di) return -ENOMEM; - } if (!plat) { - dev_err(&pdev->dev, "no battery management data supplied\n"); + dev_err(dev, "no battery management data supplied\n"); return -EINVAL; } di->bm = plat; if (np) { - ret = ab8500_bm_of_probe(&pdev->dev, np, di->bm); + ret = ab8500_bm_of_probe(dev, np, di->bm); if (ret) { - dev_err(&pdev->dev, "failed to get battery information\n"); + dev_err(dev, "failed to get battery information\n"); return ret; } } @@ -3064,14 +3063,14 @@ static int ab8500_fg_probe(struct platform_device *pdev) mutex_init(&di->cc_lock); /* get parent data */ - di->dev = &pdev->dev; + di->dev = dev; di->parent = dev_get_drvdata(pdev->dev.parent); - di->main_bat_v = devm_iio_channel_get(&pdev->dev, "main_bat_v"); + di->main_bat_v = devm_iio_channel_get(dev, "main_bat_v"); if (IS_ERR(di->main_bat_v)) { if (PTR_ERR(di->main_bat_v) == -ENODEV) return -EPROBE_DEFER; - dev_err(&pdev->dev, "failed to get main battery ADC channel\n"); + dev_err(dev, "failed to get main battery ADC channel\n"); return PTR_ERR(di->main_bat_v); } @@ -3094,7 +3093,7 @@ static int ab8500_fg_probe(struct platform_device *pdev) /* Create a work queue for running the FG algorithm */ di->fg_wq = alloc_ordered_workqueue("ab8500_fg_wq", WQ_MEM_RECLAIM); if (di->fg_wq == NULL) { - dev_err(di->dev, "failed to create work queue\n"); + dev_err(dev, "failed to create work queue\n"); return -ENOMEM; } @@ -3129,7 +3128,7 @@ static int ab8500_fg_probe(struct platform_device *pdev) /* Initialize OVV, and other registers */ ret = ab8500_fg_init_hw_registers(di); if (ret) { - dev_err(di->dev, "failed to initialize registers\n"); + dev_err(dev, "failed to initialize registers\n"); goto free_inst_curr_wq; } @@ -3138,9 +3137,9 @@ static int ab8500_fg_probe(struct platform_device *pdev) di->flags.batt_id_received = false; /* Register FG power supply class */ - di->fg_psy = power_supply_register(di->dev, &ab8500_fg_desc, &psy_cfg); + di->fg_psy = power_supply_register(dev, &ab8500_fg_desc, &psy_cfg); if (IS_ERR(di->fg_psy)) { - dev_err(di->dev, "failed to register FG psy\n"); + dev_err(dev, "failed to register FG psy\n"); ret = PTR_ERR(di->fg_psy); goto free_inst_curr_wq; } @@ -3168,11 +3167,11 @@ static int ab8500_fg_probe(struct platform_device *pdev) ab8500_fg_irq_th[i].name, di); if (ret != 0) { - dev_err(di->dev, "failed to request %s IRQ %d: %d\n", + dev_err(dev, "failed to request %s IRQ %d: %d\n", ab8500_fg_irq_th[i].name, irq, ret); goto free_irq_th; } - dev_dbg(di->dev, "Requested %s IRQ %d: %d\n", + dev_dbg(dev, "Requested %s IRQ %d: %d\n", ab8500_fg_irq_th[i].name, irq, ret); } @@ -3188,11 +3187,11 @@ static int ab8500_fg_probe(struct platform_device *pdev) ab8500_fg_irq_bh[0].name, di); if (ret != 0) { - dev_err(di->dev, "failed to request %s IRQ %d: %d\n", + dev_err(dev, "failed to request %s IRQ %d: %d\n", ab8500_fg_irq_bh[0].name, irq, ret); goto free_irq_th; } - dev_dbg(di->dev, "Requested %s IRQ %d: %d\n", + dev_dbg(dev, "Requested %s IRQ %d: %d\n", ab8500_fg_irq_bh[0].name, irq, ret); di->irq = platform_get_irq_byname(pdev, "CCEOC"); @@ -3203,13 +3202,13 @@ static int ab8500_fg_probe(struct platform_device *pdev) ret = ab8500_fg_sysfs_init(di); if (ret) { - dev_err(di->dev, "failed to create sysfs entry\n"); + dev_err(dev, "failed to create sysfs entry\n"); goto free_irq; } ret = ab8500_fg_sysfs_psy_create_attrs(di); if (ret) { - dev_err(di->dev, "failed to create FG psy\n"); + dev_err(dev, "failed to create FG psy\n"); ab8500_fg_sysfs_exit(di); goto free_irq; } From patchwork Sat Dec 12 10:57:09 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 342868 Delivered-To: patch@linaro.org Received: by 2002:a02:85a7:0:0:0:0:0 with SMTP id d36csp1348693jai; Sat, 12 Dec 2020 02:59:20 -0800 (PST) X-Google-Smtp-Source: ABdhPJwMEiUzqYSZ+YLXnkaljDF0SE+XBwl3vH8jleuA4p6cnQYXllP5IpzQbhIadXur4Z6Zg1Pa X-Received: by 2002:a05:6402:21a:: with SMTP id t26mr16339401edv.173.1607770760260; Sat, 12 Dec 2020 02:59:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607770760; cv=none; d=google.com; s=arc-20160816; b=kMRTUARDQRtIFlJ8U9wfKIAJ5TiveC8n+b9E+cCIGxCKxg2olGiSFKYCREgui9e7dR Y1BQ/dUMh7EdJkQnVqDKQgIVG6kOga136r2fQsyNHQh8jDRBHi/bHMk+0usqC9981NLX lXbgtZSZXJPCtIqb2DBW1SJK054BLpvyxyeZQkpqsG991SiepsQGJ17Z3rRDGO/2U0iF GOV18uVMpOn6iHhS7OIa1u7x3vFkWSSTJHRyd496SIcOlnd59ucL6caS1o/QUw7+cjw3 dikMjQ3rS+wMQvofmFdk822G0Y3bNb5jNNmjh6ZPoFGc/8yn6DPKELRIbHhYmqQBN87B t5UQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=sWX5eE1xOf9NUniflRKOxAe5PsjQfTfWOM1x60DKsqU=; b=RzS+y6+wU2W2yW87LnYi444AheYm6AkmwmwwMG2W7kNmi1Mdd30Dwp7yD53Nanzi4u jLIGp+ZqwP1Q41Ze7qENYDc1+P9rN6v6Xw74oDUCJ6rMkQmb4/jM/Li1MVVCWvqw2K/E LgESssjDZOsamJRx2yKld1bqVnm+tkDPguCyxX3B4JuM8CjYuluiu9+vFiQA8nqbPDF9 zDTA/upmvb1q0lEcu7IFwK8Wd9kKyZ16pZBYXr6w7CVGym1CBtz3XLPcvcxnCx1b6GqE tAeYlQjc4KfwlJRI3xgFhA4fEinCngtti69B5CCHjCG7dl4tU8BF1+tTsCjVXwXF79pl TaBw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=FIDv0+pF; spf=pass (google.com: domain of linux-pm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-pm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dp1si6354112ejc.21.2020.12.12.02.59.20; Sat, 12 Dec 2020 02:59:20 -0800 (PST) Received-SPF: pass (google.com: domain of linux-pm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=FIDv0+pF; spf=pass (google.com: domain of linux-pm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-pm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2438848AbgLLK6J (ORCPT + 8 others); Sat, 12 Dec 2020 05:58:09 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51448 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2438853AbgLLK6E (ORCPT ); Sat, 12 Dec 2020 05:58:04 -0500 Received: from mail-lf1-x141.google.com (mail-lf1-x141.google.com [IPv6:2a00:1450:4864:20::141]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F2DE2C061793 for ; Sat, 12 Dec 2020 02:57:23 -0800 (PST) Received: by mail-lf1-x141.google.com with SMTP id a8so17981906lfb.3 for ; Sat, 12 Dec 2020 02:57:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=sWX5eE1xOf9NUniflRKOxAe5PsjQfTfWOM1x60DKsqU=; b=FIDv0+pFTVraDrY/d9H67Yol4HuHm2qgwQeeEMLbAz66ji3a8JQiMdFJtaNJHcwnv0 9MDWlTvXMTCRKIkMJEGaW8O2YhVJAuovnAOLU20T0IKXa0TnsZNWoSVWWBlJZB2C/h4k 2i7wYfFZ3AFA7iHGhdX4OU+VGTJ5lT1fc5f/iQ16k0mJxqr1em46SZvhccjQr88l0YSL Ym6sSPy/47A3gdtYmSqlGrYtvkvyvEz53Eo2gc7QPl0SRPMcoPZMXOR0H3XhTlAdKQ1f wfbBRPXquwZc8PHL1mRwKu0cGwOMBICaIW6HqCz2omT1lPCzOusRE+UGyepQKw+poFRF g/iQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=sWX5eE1xOf9NUniflRKOxAe5PsjQfTfWOM1x60DKsqU=; b=S89aB6Vb2GO2DMiRyWsYzlMopjPb+kDDV5LB7z1Yxn9cS2mbdfLYflEEn7+J2ru0wB 3CEmCpH+oOJLP0t24GgyQ3YGlgFVI2s0vwQag2l3bmP6mVd7vTVLvGrHP282UhuLP2GO KmfouH+1gqp9ADkfFRjXL+WCAw9GV3bc0Rfd1Xo6VZyRayoP6+wwiY/UY8hnR+RqPOse QjwYjmg80ULx0IjiwCMuSeiHIzlcXYl2/rM0LsResbbTosCyVdcRWcbqs+67BlkGhxlz yqbVDjz1WNBOajra5utdvXkhA29bBnfqTEdhzPUPiBJAR5M1VLil5GkomeucCMI+r17m +FXg== X-Gm-Message-State: AOAM5317GF5KAEneLLiEg+yjWUdk3h/wK/s+8vxr9AA2Yv4A7kVZ6LQC WF0Awu7++sXA8rLJr9emf78Obw== X-Received: by 2002:a2e:88d6:: with SMTP id a22mr6962040ljk.150.1607770642475; Sat, 12 Dec 2020 02:57:22 -0800 (PST) Received: from localhost.bredbandsbolaget (c-92d7225c.014-348-6c756e10.bbcust.telenor.se. [92.34.215.146]) by smtp.gmail.com with ESMTPSA id j2sm490674lfe.213.2020.12.12.02.57.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 12 Dec 2020 02:57:22 -0800 (PST) From: Linus Walleij To: Sebastian Reichel , Marcus Cooper Cc: linux-pm@vger.kernel.org, Linus Walleij Subject: [PATCH 2/5] power: supply: ab8500: Convert to dev_pm_ops Date: Sat, 12 Dec 2020 11:57:09 +0100 Message-Id: <20201212105712.2727842-3-linus.walleij@linaro.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20201212105712.2727842-1-linus.walleij@linaro.org> References: <20201212105712.2727842-1-linus.walleij@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org Switch over to using generic dev_pm_ops since these drivers aren't even using the special power state passed to the legacy call. Cc: Marcus Cooper Signed-off-by: Linus Walleij --- drivers/power/supply/ab8500_btemp.c | 19 +++++++------------ drivers/power/supply/ab8500_charger.c | 19 +++++++------------ drivers/power/supply/ab8500_fg.c | 19 +++++++------------ drivers/power/supply/abx500_chargalg.c | 19 +++++++------------ 4 files changed, 28 insertions(+), 48 deletions(-) -- 2.26.2 diff --git a/drivers/power/supply/ab8500_btemp.c b/drivers/power/supply/ab8500_btemp.c index 06b4247ebc45..1f8fded47b2e 100644 --- a/drivers/power/supply/ab8500_btemp.c +++ b/drivers/power/supply/ab8500_btemp.c @@ -936,29 +936,23 @@ static struct ab8500_btemp_interrupts ab8500_btemp_irq[] = { {"BTEMP_MEDIUM_HIGH", ab8500_btemp_medhigh_handler}, }; -#if defined(CONFIG_PM) -static int ab8500_btemp_resume(struct platform_device *pdev) +static int __maybe_unused ab8500_btemp_resume(struct device *dev) { - struct ab8500_btemp *di = platform_get_drvdata(pdev); + struct ab8500_btemp *di = dev_get_drvdata(dev); ab8500_btemp_periodic(di, true); return 0; } -static int ab8500_btemp_suspend(struct platform_device *pdev, - pm_message_t state) +static int __maybe_unused ab8500_btemp_suspend(struct device *dev) { - struct ab8500_btemp *di = platform_get_drvdata(pdev); + struct ab8500_btemp *di = dev_get_drvdata(dev); ab8500_btemp_periodic(di, false); return 0; } -#else -#define ab8500_btemp_suspend NULL -#define ab8500_btemp_resume NULL -#endif static int ab8500_btemp_remove(struct platform_device *pdev) { @@ -1137,6 +1131,8 @@ static int ab8500_btemp_probe(struct platform_device *pdev) return ret; } +static SIMPLE_DEV_PM_OPS(ab8500_btemp_pm_ops, ab8500_btemp_suspend, ab8500_btemp_resume); + static const struct of_device_id ab8500_btemp_match[] = { { .compatible = "stericsson,ab8500-btemp", }, { }, @@ -1145,11 +1141,10 @@ static const struct of_device_id ab8500_btemp_match[] = { static struct platform_driver ab8500_btemp_driver = { .probe = ab8500_btemp_probe, .remove = ab8500_btemp_remove, - .suspend = ab8500_btemp_suspend, - .resume = ab8500_btemp_resume, .driver = { .name = "ab8500-btemp", .of_match_table = ab8500_btemp_match, + .pm = &ab8500_btemp_pm_ops, }, }; diff --git a/drivers/power/supply/ab8500_charger.c b/drivers/power/supply/ab8500_charger.c index 7e28ac1b171b..47f1ce1012f4 100644 --- a/drivers/power/supply/ab8500_charger.c +++ b/drivers/power/supply/ab8500_charger.c @@ -3209,11 +3209,10 @@ static int ab8500_charger_usb_notifier_call(struct notifier_block *nb, return NOTIFY_OK; } -#if defined(CONFIG_PM) -static int ab8500_charger_resume(struct platform_device *pdev) +static int __maybe_unused ab8500_charger_resume(struct device *dev) { int ret; - struct ab8500_charger *di = platform_get_drvdata(pdev); + struct ab8500_charger *di = dev_get_drvdata(dev); /* * For ABB revision 1.0 and 1.1 there is a bug in the watchdog @@ -3247,10 +3246,9 @@ static int ab8500_charger_resume(struct platform_device *pdev) return 0; } -static int ab8500_charger_suspend(struct platform_device *pdev, - pm_message_t state) +static int __maybe_unused ab8500_charger_suspend(struct device *dev) { - struct ab8500_charger *di = platform_get_drvdata(pdev); + struct ab8500_charger *di = dev_get_drvdata(dev); /* Cancel any pending jobs */ cancel_delayed_work(&di->check_hw_failure_work); @@ -3272,10 +3270,6 @@ static int ab8500_charger_suspend(struct platform_device *pdev, return 0; } -#else -#define ab8500_charger_suspend NULL -#define ab8500_charger_resume NULL -#endif static struct notifier_block charger_nb = { .notifier_call = ab8500_external_charger_prepare, @@ -3658,6 +3652,8 @@ static int ab8500_charger_probe(struct platform_device *pdev) return ret; } +static SIMPLE_DEV_PM_OPS(ab8500_charger_pm_ops, ab8500_charger_suspend, ab8500_charger_resume); + static const struct of_device_id ab8500_charger_match[] = { { .compatible = "stericsson,ab8500-charger", }, { }, @@ -3666,11 +3662,10 @@ static const struct of_device_id ab8500_charger_match[] = { static struct platform_driver ab8500_charger_driver = { .probe = ab8500_charger_probe, .remove = ab8500_charger_remove, - .suspend = ab8500_charger_suspend, - .resume = ab8500_charger_resume, .driver = { .name = "ab8500-charger", .of_match_table = ab8500_charger_match, + .pm = &ab8500_charger_pm_ops, }, }; diff --git a/drivers/power/supply/ab8500_fg.c b/drivers/power/supply/ab8500_fg.c index 56997353c175..ba8dba0d6395 100644 --- a/drivers/power/supply/ab8500_fg.c +++ b/drivers/power/supply/ab8500_fg.c @@ -2942,10 +2942,9 @@ static void ab8500_fg_sysfs_psy_remove_attrs(struct ab8500_fg *di) /* Exposure to the sysfs interface <> */ -#if defined(CONFIG_PM) -static int ab8500_fg_resume(struct platform_device *pdev) +static int __maybe_unused ab8500_fg_resume(struct device *dev) { - struct ab8500_fg *di = platform_get_drvdata(pdev); + struct ab8500_fg *di = dev_get_drvdata(dev); /* * Change state if we're not charging. If we're charging we will wake @@ -2959,10 +2958,9 @@ static int ab8500_fg_resume(struct platform_device *pdev) return 0; } -static int ab8500_fg_suspend(struct platform_device *pdev, - pm_message_t state) +static int __maybe_unused ab8500_fg_suspend(struct device *dev) { - struct ab8500_fg *di = platform_get_drvdata(pdev); + struct ab8500_fg *di = dev_get_drvdata(dev); flush_delayed_work(&di->fg_periodic_work); flush_work(&di->fg_work); @@ -2980,10 +2978,6 @@ static int ab8500_fg_suspend(struct platform_device *pdev, return 0; } -#else -#define ab8500_fg_suspend NULL -#define ab8500_fg_resume NULL -#endif static int ab8500_fg_remove(struct platform_device *pdev) { @@ -3244,6 +3238,8 @@ static int ab8500_fg_probe(struct platform_device *pdev) return ret; } +static SIMPLE_DEV_PM_OPS(ab8500_fg_pm_ops, ab8500_fg_suspend, ab8500_fg_resume); + static const struct of_device_id ab8500_fg_match[] = { { .compatible = "stericsson,ab8500-fg", }, { }, @@ -3252,11 +3248,10 @@ static const struct of_device_id ab8500_fg_match[] = { static struct platform_driver ab8500_fg_driver = { .probe = ab8500_fg_probe, .remove = ab8500_fg_remove, - .suspend = ab8500_fg_suspend, - .resume = ab8500_fg_resume, .driver = { .name = "ab8500-fg", .of_match_table = ab8500_fg_match, + .pm = &ab8500_fg_pm_ops, }, }; diff --git a/drivers/power/supply/abx500_chargalg.c b/drivers/power/supply/abx500_chargalg.c index 175c4f3d7955..a9d84d845f24 100644 --- a/drivers/power/supply/abx500_chargalg.c +++ b/drivers/power/supply/abx500_chargalg.c @@ -1913,10 +1913,9 @@ static int abx500_chargalg_sysfs_init(struct abx500_chargalg *di) } /* Exposure to the sysfs interface <> */ -#if defined(CONFIG_PM) -static int abx500_chargalg_resume(struct platform_device *pdev) +static int __maybe_unused abx500_chargalg_resume(struct device *dev) { - struct abx500_chargalg *di = platform_get_drvdata(pdev); + struct abx500_chargalg *di = dev_get_drvdata(dev); /* Kick charger watchdog if charging (any charger online) */ if (di->chg_info.online_chg) @@ -1931,10 +1930,9 @@ static int abx500_chargalg_resume(struct platform_device *pdev) return 0; } -static int abx500_chargalg_suspend(struct platform_device *pdev, - pm_message_t state) +static int __maybe_unused abx500_chargalg_suspend(struct device *dev) { - struct abx500_chargalg *di = platform_get_drvdata(pdev); + struct abx500_chargalg *di = dev_get_drvdata(dev); if (di->chg_info.online_chg) cancel_delayed_work_sync(&di->chargalg_wd_work); @@ -1943,10 +1941,6 @@ static int abx500_chargalg_suspend(struct platform_device *pdev, return 0; } -#else -#define abx500_chargalg_suspend NULL -#define abx500_chargalg_resume NULL -#endif static int abx500_chargalg_remove(struct platform_device *pdev) { @@ -2080,6 +2074,8 @@ static int abx500_chargalg_probe(struct platform_device *pdev) return ret; } +static SIMPLE_DEV_PM_OPS(abx500_chargalg_pm_ops, abx500_chargalg_suspend, abx500_chargalg_resume); + static const struct of_device_id ab8500_chargalg_match[] = { { .compatible = "stericsson,ab8500-chargalg", }, { }, @@ -2088,11 +2084,10 @@ static const struct of_device_id ab8500_chargalg_match[] = { static struct platform_driver abx500_chargalg_driver = { .probe = abx500_chargalg_probe, .remove = abx500_chargalg_remove, - .suspend = abx500_chargalg_suspend, - .resume = abx500_chargalg_resume, .driver = { .name = "ab8500-chargalg", .of_match_table = ab8500_chargalg_match, + .pm = &abx500_chargalg_pm_ops, }, }; From patchwork Sat Dec 12 10:57:10 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 342869 Delivered-To: patch@linaro.org Received: by 2002:a02:85a7:0:0:0:0:0 with SMTP id d36csp1348699jai; Sat, 12 Dec 2020 02:59:20 -0800 (PST) X-Google-Smtp-Source: ABdhPJz10DvYLYgEcA61pQW/JKA2AZHT9lyiFCHBjwDqtHTxY/fTwBn2i4YVuMur3dLfUe3NagcR X-Received: by 2002:a17:906:fc3:: with SMTP id c3mr15255351ejk.474.1607770760656; Sat, 12 Dec 2020 02:59:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607770760; cv=none; d=google.com; s=arc-20160816; b=k9vJTTV4Z+5/peICwPKaGmhAj5E7j5osGErC+wWVTiCsS6bPkJ62hpDeRLSy/L5YLE Yx+dmTVFUc5ilK1bFR6whDuAqL6XtDzJEUDR4gBvfV8nwnZYxWQWb/IldK9hCeg+j8iS ajc9U/tDtF0pumSD59LDB/yiKhmvbJ+vhVY3k5mO49ZOB8dGp/nsQCIgJQq7vx4HSkpe HNg/uPKdbDhTXWE5ZmL2cvZcnjFnE1us6elXpBzbZzH/7zrJP8Sn406MJpnEY64MRbX1 HZM7EOOGFozHTW0E3YFaBVo9bcmopgu/9Do193k6deNrwmtk/tzhvSrWVtc/EEsjYO7E Wnvg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=U9ki1Yt4gjIfiYkS0P/4SKvIacQ9wKk9cuDvKvw5s1A=; b=fzCEULjlokHYEJbWHmjJpTMAEZFDKEPCgX7TOzugdxQRHESbcO9p7yFsheyrInIIPp YqkY9t1YStogcxOojXazIlywO/+4psmqTLaK9ssgQIY2WBebzb4e3RGM1U0tCHEgYmVG bP9kbhrBmScqb9lKQIq7bDSj2FF0F6W1LHpHBJEl3oAmg8WDXMhZGvdXkZDYSJtw63HU jTmnFYw54ylfJuGnLkl3xqk7lw+To3zGkI5qXFDSyagH4rEC6dApFv5TfMNVFj6gTSxf KeE4s3LOWX4pyw1JPu85GOJpBfWPGlx8O2uV7w3VJ3P0N4R9bqmxCBBUKrsj7XA/GnCU cWlw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=V1cRNEcv; spf=pass (google.com: domain of linux-pm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-pm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dp1si6354112ejc.21.2020.12.12.02.59.20; Sat, 12 Dec 2020 02:59:20 -0800 (PST) Received-SPF: pass (google.com: domain of linux-pm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=V1cRNEcv; spf=pass (google.com: domain of linux-pm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-pm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2438853AbgLLK6L (ORCPT + 8 others); Sat, 12 Dec 2020 05:58:11 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51454 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2438856AbgLLK6F (ORCPT ); Sat, 12 Dec 2020 05:58:05 -0500 Received: from mail-lf1-x142.google.com (mail-lf1-x142.google.com [IPv6:2a00:1450:4864:20::142]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 41351C061794 for ; Sat, 12 Dec 2020 02:57:25 -0800 (PST) Received: by mail-lf1-x142.google.com with SMTP id w13so17965649lfd.5 for ; Sat, 12 Dec 2020 02:57:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=U9ki1Yt4gjIfiYkS0P/4SKvIacQ9wKk9cuDvKvw5s1A=; b=V1cRNEcv/63CSwMTY5HdzFgTOXrLNfnAD6jxwYDIZgdQ6BaGd0ECcNDU2dyIthVkhZ vxCoUz5zOq4S83Uz/D2OD/x+XDF34PRmN7zvFMvPt5ZczVUPabamei65vuIQxvz/U2sh vRu4tfjLqSE8arKhxalPBHcXRWBVQU1uvyRwOw5qDOegVUI4Xi6RC+gqfmwgh3xChGRU 3oCzsAp5hafSsEk4GkyLaLFqbPux/+ChNU2jdGqbQykPwFfnqsQt8xXduLWv9aSi8ABw qWHrXeskl60dumiBGuefooFu3V3yN1NFl7CmJ5WLPSGZDk6asQJUmJe543Sf+67tj6Yu 6Hgw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=U9ki1Yt4gjIfiYkS0P/4SKvIacQ9wKk9cuDvKvw5s1A=; b=IJX9xJ0YhToZwJsAbhwpTeinB8O4HJrBCcifnuXcKvixeWhSaXLqNJml8Q4RbBwIYr +cafh7p+XoPjh2fbhp6JKhmVLQH2Om7T6dydi1c186/SO+QwFjgbhes4lmgIy1RQs5up AzlUIPpiiCUjBRDjx5DC2fRUVFhLGETOVfdu1X/1UUjQGhyolaCc9nExWsMh1on69iiJ nwdhSxPbv+qnl2ljWMn+S/Uw/GNnQxQDUx4L7vxPNTUqYIpF55hTJ6Kurg3FOKABYluz WbpNy2q4mgq9j+El3vLq0s9mKsusX3cZCb76aFQTxTMm8nSWYf+mDilbzuj96+CSn0y+ SgJQ== X-Gm-Message-State: AOAM530wRotwLxvevoD4AOYmydqePCWqwuwkNAP7zFlIoUNRdz1N4PHF xxknplxp7kGKUed8UYNcard87g== X-Received: by 2002:a05:651c:200a:: with SMTP id s10mr6808399ljo.492.1607770643811; Sat, 12 Dec 2020 02:57:23 -0800 (PST) Received: from localhost.bredbandsbolaget (c-92d7225c.014-348-6c756e10.bbcust.telenor.se. [92.34.215.146]) by smtp.gmail.com with ESMTPSA id j2sm490674lfe.213.2020.12.12.02.57.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 12 Dec 2020 02:57:23 -0800 (PST) From: Linus Walleij To: Sebastian Reichel , Marcus Cooper Cc: linux-pm@vger.kernel.org, Linus Walleij Subject: [PATCH 3/5] power: supply: ab8500_charger: Oneshot threaded IRQs Date: Sat, 12 Dec 2020 11:57:10 +0100 Message-Id: <20201212105712.2727842-4-linus.walleij@linaro.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20201212105712.2727842-1-linus.walleij@linaro.org> References: <20201212105712.2727842-1-linus.walleij@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org Make sure the threaded IRQs requested by the charger are flagged as "oneshot". Usually this is what you want, and since the interrupts are shared with the USB phy on the AB8500 we will get a conflict like this if we don't, since the phy request them threaded oneshot: genirq: Flags mismatch irq 83. 00004084 (USB_LINK_STATUS vs. 00006084 (usb-link-status) ab8500-charger ab8500-charger.0: failed to request USB_LINK_STATUS IRQ 83: -16 Cc: Marcus Cooper Signed-off-by: Linus Walleij --- drivers/power/supply/ab8500_charger.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.26.2 diff --git a/drivers/power/supply/ab8500_charger.c b/drivers/power/supply/ab8500_charger.c index 47f1ce1012f4..d4b7bd68451b 100644 --- a/drivers/power/supply/ab8500_charger.c +++ b/drivers/power/supply/ab8500_charger.c @@ -3596,7 +3596,7 @@ static int ab8500_charger_probe(struct platform_device *pdev) } ret = request_threaded_irq(irq, NULL, ab8500_charger_irq[i].isr, - IRQF_SHARED | IRQF_NO_SUSPEND, + IRQF_SHARED | IRQF_NO_SUSPEND | IRQF_ONESHOT, ab8500_charger_irq[i].name, di); if (ret != 0) { From patchwork Sat Dec 12 10:57:11 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 342870 Delivered-To: patch@linaro.org Received: by 2002:a02:85a7:0:0:0:0:0 with SMTP id d36csp1348722jai; Sat, 12 Dec 2020 02:59:22 -0800 (PST) X-Google-Smtp-Source: ABdhPJzrNGMOG9iV+Q+XdRmZmSjuyacEU3jbvRX4Yg3kohh/gUAU9QGs3/atglzAOVO9J9bz8Usa X-Received: by 2002:a17:907:d09:: with SMTP id gn9mr11465106ejc.349.1607770762179; Sat, 12 Dec 2020 02:59:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607770762; cv=none; d=google.com; s=arc-20160816; b=dwt4CNaXpR8wh6TpBennWdP6jJf/s4tgclI5rL2L0e3zb4Sbx44vasOZ3NR2BWvVLG /ahfMM8g2SkBS6EVTF71bjm5GfPsG1IzcAhCyb7aEUlgqTKSu/VBh1J2FBAO8x7vCDaG QkAAjrp4LhryD5bQxha/55G05CWhBN/JJa4YnswdqvQJCK4Jgwwirt6wOcum/OqVszQz soZvGec0NnczVrFgSxEMzJYMv/hycn7QIR1vo4dFleQUD6C0yG8vPbtQ50h9IFcL6NPY z+fX8vqETk8Js5OqGPa86b3T+tE7OWSJ6yt1zUaAB0AXJtCFiQ94YQ0ZhlsyJspxTFu+ TLjg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=dlBoKDqFhqpfZF4qBQ5hZ7IttfE84hn1sKPugi2k9fY=; b=e9aSVJfmT34CpNwKH+xQlD1v9LBfwOmgRikLrwN6gmvNy0fHO8neSQStDOQTYowBVa l/XpmNmwq5ERnMMP8r8GmgBvaczLS4WVEf3O8IiOFvo/5UANd/5JyDU3Wm3aDFT8NE7M GivOJrOIVW7gSHP2N0lR2m+HKWR+I1saIWiIolzPOhl1GfPcbsk2ix0WIffChD3psL52 q5zKyeKzL0VW16NMyVhiWI/N2Z7xxjkScr5TcpziOiuE8PnNm4W9EDk6kJ6ITlrxhR1R o8o7gaO76VmDnn0yh/CG6TCyQE/q1VEeIfoTkS1fyhA/k8J9gQd6rHuMG6qjuRHUfzQk XcXw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="oP4cJ/sl"; spf=pass (google.com: domain of linux-pm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-pm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dp1si6354112ejc.21.2020.12.12.02.59.21; Sat, 12 Dec 2020 02:59:22 -0800 (PST) Received-SPF: pass (google.com: domain of linux-pm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="oP4cJ/sl"; spf=pass (google.com: domain of linux-pm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-pm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2393911AbgLLK6q (ORCPT + 8 others); Sat, 12 Dec 2020 05:58:46 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51544 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2392765AbgLLK6k (ORCPT ); Sat, 12 Dec 2020 05:58:40 -0500 Received: from mail-lf1-x144.google.com (mail-lf1-x144.google.com [IPv6:2a00:1450:4864:20::144]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 13F94C06179C for ; Sat, 12 Dec 2020 02:57:26 -0800 (PST) Received: by mail-lf1-x144.google.com with SMTP id 23so17962733lfg.10 for ; Sat, 12 Dec 2020 02:57:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=dlBoKDqFhqpfZF4qBQ5hZ7IttfE84hn1sKPugi2k9fY=; b=oP4cJ/slP1g9dOQiY6DJb76V3JMwSW1GI+BBD09qEu+ZpWXtp87AYxMip5zkv1Tgk/ D7ffU4b8hNkWf8te3yq4lcAog0Rm3TmtnYe+F4GYrY7gim6atbtjV0UE3mFd7/L19Ich VxZ8HcQPKV6VDE/dtBUInb5T7UJe48gaQhgFACC13k93pYOo0FmEGuLDaRX66CjgEOjs 4dcDcEw3PYxXyN4rV3WQg3LoJlsk6YvgLFteRRMuk0xZXf9aGPzjX/ch7c0sgN47gOfq OahzxtCF7ZN/c5PntXLuhPXEWkcXE/yDhhcTjhQ1rLnQnNxV4uIDpSynCuP+v3xvFSb/ F43w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=dlBoKDqFhqpfZF4qBQ5hZ7IttfE84hn1sKPugi2k9fY=; b=ZntXI0bbIp6FzwzBoyIhQIjLab+E5OZHpbIwfMjTlF8okOOmeFDk992tfabtC1fQ96 cMI5BJklQ+XlY56T5OxbFPCwnieRwTNIFMAeW4NjvyC9CJW29CCQIg2wc4j+P8pjIi8a 23xiVL/+IGYfu9TzCOrMckj90IMKrYDjQmspdA+vHRDA3yMmP2cOUEHJGHdKMO5hQJy5 pes4PinAl37R/WLrf+00jtrkRg/5Se4S3ORz2VudybXvgMjkv7x9sHcvjWWxyqow/Fo3 Oyka3t4RJyUq8u27fzuEWSGwEd/wz9im9Sb2fbQRW2dLdVJdfU+WKSyEWmHDPvyW+hDp Qskw== X-Gm-Message-State: AOAM5301vDfTpU6WnjOK0uDAo1ncuyuk9dWCr7qu1GWyG+AmvU9sc5P6 PcMM9hS6zLj0uwqnXp6qPIbsav2aLVGRT1bO X-Received: by 2002:a2e:3a04:: with SMTP id h4mr4364607lja.156.1607770645130; Sat, 12 Dec 2020 02:57:25 -0800 (PST) Received: from localhost.bredbandsbolaget (c-92d7225c.014-348-6c756e10.bbcust.telenor.se. [92.34.215.146]) by smtp.gmail.com with ESMTPSA id j2sm490674lfe.213.2020.12.12.02.57.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 12 Dec 2020 02:57:24 -0800 (PST) From: Linus Walleij To: Sebastian Reichel , Marcus Cooper Cc: linux-pm@vger.kernel.org, Linus Walleij Subject: [PATCH 4/5] power: supply: ab8500_fg: Request all IRQs as threaded Date: Sat, 12 Dec 2020 11:57:11 +0100 Message-Id: <20201212105712.2727842-5-linus.walleij@linaro.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20201212105712.2727842-1-linus.walleij@linaro.org> References: <20201212105712.2727842-1-linus.walleij@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org Since these IRQs are cascaded from a nested IRQ, the generic IRQ system detects this and refuse to deliver a fastpath IRQ in response to request_irq(): nested = irq_settings_is_nested_thread(desc); if (nested) { if (!new->thread_fn) { ret = -EINVAL; goto out_mput; } (...) Threaded IRQs work just as well so let's just request threaded IRQs. One of the IRQs are alread requested as threaded anyways. Cc: Marcus Cooper Signed-off-by: Linus Walleij --- drivers/power/supply/ab8500_fg.c | 47 ++++++++------------------------ 1 file changed, 11 insertions(+), 36 deletions(-) -- 2.26.2 diff --git a/drivers/power/supply/ab8500_fg.c b/drivers/power/supply/ab8500_fg.c index ba8dba0d6395..d1b68acac427 100644 --- a/drivers/power/supply/ab8500_fg.c +++ b/drivers/power/supply/ab8500_fg.c @@ -3001,14 +3001,11 @@ static int ab8500_fg_remove(struct platform_device *pdev) } /* ab8500 fg driver interrupts and their respective isr */ -static struct ab8500_fg_interrupts ab8500_fg_irq_th[] = { +static struct ab8500_fg_interrupts ab8500_fg_irq[] = { {"NCONV_ACCU", ab8500_fg_cc_convend_handler}, {"BATT_OVV", ab8500_fg_batt_ovv_handler}, {"LOW_BAT_F", ab8500_fg_lowbatf_handler}, {"CC_INT_CALIB", ab8500_fg_cc_int_calib_handler}, -}; - -static struct ab8500_fg_interrupts ab8500_fg_irq_bh[] = { {"CCEOC", ab8500_fg_cc_data_end_handler}, }; @@ -3149,44 +3146,25 @@ static int ab8500_fg_probe(struct platform_device *pdev) init_completion(&di->ab8500_fg_complete); /* Register primary interrupt handlers */ - for (i = 0; i < ARRAY_SIZE(ab8500_fg_irq_th); i++) { - irq = platform_get_irq_byname(pdev, ab8500_fg_irq_th[i].name); + for (i = 0; i < ARRAY_SIZE(ab8500_fg_irq); i++) { + irq = platform_get_irq_byname(pdev, ab8500_fg_irq[i].name); if (irq < 0) { ret = irq; - goto free_irq_th; + goto free_irq; } - ret = request_irq(irq, ab8500_fg_irq_th[i].isr, - IRQF_SHARED | IRQF_NO_SUSPEND, - ab8500_fg_irq_th[i].name, di); + ret = request_threaded_irq(irq, NULL, ab8500_fg_irq[i].isr, + IRQF_SHARED | IRQF_NO_SUSPEND | IRQF_ONESHOT, + ab8500_fg_irq[i].name, di); if (ret != 0) { dev_err(dev, "failed to request %s IRQ %d: %d\n", - ab8500_fg_irq_th[i].name, irq, ret); - goto free_irq_th; + ab8500_fg_irq[i].name, irq, ret); + goto free_irq; } dev_dbg(dev, "Requested %s IRQ %d: %d\n", - ab8500_fg_irq_th[i].name, irq, ret); - } - - /* Register threaded interrupt handler */ - irq = platform_get_irq_byname(pdev, ab8500_fg_irq_bh[0].name); - if (irq < 0) { - ret = irq; - goto free_irq_th; - } - - ret = request_threaded_irq(irq, NULL, ab8500_fg_irq_bh[0].isr, - IRQF_SHARED | IRQF_NO_SUSPEND | IRQF_ONESHOT, - ab8500_fg_irq_bh[0].name, di); - - if (ret != 0) { - dev_err(dev, "failed to request %s IRQ %d: %d\n", - ab8500_fg_irq_bh[0].name, irq, ret); - goto free_irq_th; + ab8500_fg_irq[i].name, irq, ret); } - dev_dbg(dev, "Requested %s IRQ %d: %d\n", - ab8500_fg_irq_bh[0].name, irq, ret); di->irq = platform_get_irq_byname(pdev, "CCEOC"); disable_irq(di->irq); @@ -3223,12 +3201,9 @@ static int ab8500_fg_probe(struct platform_device *pdev) free_irq: /* We also have to free all registered irqs */ - irq = platform_get_irq_byname(pdev, ab8500_fg_irq_bh[0].name); - free_irq(irq, di); -free_irq_th: while (--i >= 0) { /* Last assignment of i from primary interrupt handlers */ - irq = platform_get_irq_byname(pdev, ab8500_fg_irq_th[i].name); + irq = platform_get_irq_byname(pdev, ab8500_fg_irq[i].name); free_irq(irq, di); } From patchwork Sat Dec 12 10:57:12 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 342871 Delivered-To: patch@linaro.org Received: by 2002:a02:85a7:0:0:0:0:0 with SMTP id d36csp1348725jai; Sat, 12 Dec 2020 02:59:22 -0800 (PST) X-Google-Smtp-Source: ABdhPJwQC7w+TaQmdANfgPagTYLFvd/VuZfO73EqWKYkDzus2dhuZcvNRAEWXbyPNuE/fIqVRoRv X-Received: by 2002:a17:906:7784:: with SMTP id s4mr14773708ejm.93.1607770762639; Sat, 12 Dec 2020 02:59:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607770762; cv=none; d=google.com; s=arc-20160816; b=z4aBDcMJmotrc7IWko/HIYeOM6RqLGTV65Bt2jpdJ6ALD7o7uX0jVUgkVwh9M2XAID F9uyOYFrv5LPzieePMA0mPMKM5S8h5PiQwulLo0IfGswAsx7a8gguzYaaIORtnCDRthM 3uQhVhehwrDiJzLu4gCnAB1mbUgmoMtuSFy9+rI168JBuyUrru5HLiqHhsh7LzHh3wh5 ey4XXookyntp9fSXwqx6Nf8u3DSZIb6e35iJ6x5TVZVUkYHyLE7F/EbZbi8wv5s0l8NG PXv8DllnQb5V2bAw/c8EQ5oQGRcPHobrZ286PKfyKBK4hQfAM/QAxfVl0aLtwel6Wfiy R4zw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=LMHfnSbcVaDTuxTUMrUrYnMsvW1YjEn1yWzITGlL+i4=; b=MTJvy94FGnDzF9mdEe8RXKL/Pya04OgqANtKqrUWVb0IIJ3toWrnfBW4DnBGPALeo1 p4N01MKDOEWHTH32gprwXa4oadeXPPWqMl/N5dLE38BdiB4lY37McgqwYJ/qcQYen81+ Nz0zxptDqR9IafIj9Nc1XE4jNR2u5eJxOLGnQM52acB7TEkx/y59thccHsPMuaDzulsu ttmr/hcdK7P3HX5Zlcid3yEv10m9+SEBeTYoeEmFIdHKkutogzpi3SE3VmjpJWjdA19I 4/3z+C5pbphPFDWhGRiQIHWKzYlZMOGiAKx+ngiPJ6GpjrHOwwjx/qQYGCxjsCk2EdzS KvZg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=MrHBFnkj; spf=pass (google.com: domain of linux-pm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-pm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dp1si6354112ejc.21.2020.12.12.02.59.22; Sat, 12 Dec 2020 02:59:22 -0800 (PST) Received-SPF: pass (google.com: domain of linux-pm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=MrHBFnkj; spf=pass (google.com: domain of linux-pm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-pm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2392765AbgLLK6s (ORCPT + 8 others); Sat, 12 Dec 2020 05:58:48 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51542 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726374AbgLLK6k (ORCPT ); Sat, 12 Dec 2020 05:58:40 -0500 Received: from mail-lf1-x143.google.com (mail-lf1-x143.google.com [IPv6:2a00:1450:4864:20::143]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1AD1BC0617A6 for ; Sat, 12 Dec 2020 02:57:27 -0800 (PST) Received: by mail-lf1-x143.google.com with SMTP id a8so17982129lfb.3 for ; Sat, 12 Dec 2020 02:57:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=LMHfnSbcVaDTuxTUMrUrYnMsvW1YjEn1yWzITGlL+i4=; b=MrHBFnkjxFT5sTku71LBP8cbf4gFqim5hKRuOYkUylL+cEL5C6Ogg60eDgYv5zY0Bp SNt+AwulO/d9Qo4GCYM1+HMkdzXuq/aIAjBY7+Zn7u44Vi9ijXnvt9SObs9AJxcE3olk JOtB16I4A1KRgsaxbOKSHkZMEZ0drMvv3MleIR4sQu7Pj7Zm4yRgZ5VgYR050OSJEWIA yX0vOw3JsVnf3cAR0hWaPI4Pwyl5pDWEFHc+LL3xk2H/lpRZ2RLSUjIBAFYkivfKLZzR NXRAncOhEDRhK15FspCP89by0hZrnGNF8xYcYvvVxUso0X9Ut2FVIJILyNqPXuyWewQD X4iw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=LMHfnSbcVaDTuxTUMrUrYnMsvW1YjEn1yWzITGlL+i4=; b=OeobMBiiBtPcdRe/ZsTfaf3WNEt+HjpBlHBmD3NdXNFNMQV9f8Q6m8p4kCiDVxueyw oZ32MkH/rZkh6rUd5Wh3vnrGqpu5/c2BSgShnrWS7vG5O4oNw9ey2AZuO36bGtYX1w4J JTxCH45IYS/6lt1M5LyTgA5lh0PDodJlguYeZw/002GzJVrC64WKkYwoJ3c9Y9G+AGlz XOR+RNxtOwz1YFPtDnijXgGUCMsxjiyezm4808edhVhLQOTC82n3WL0yqmyfQtp7lWtx s4b82r0PBovnWp22ykqBsOXLduEbrpWrqF/mgy4w7tRicAw4h3CKkuF38aBTC5lTKFdP yp9g== X-Gm-Message-State: AOAM533zJSsbgYJrhgd9uCrVI5GphMklUKE1tMqPT0VWnvKVQuq4ny+e Td4iU1sqepQapxmxjvdFD0n9gg== X-Received: by 2002:a05:651c:3db:: with SMTP id f27mr6927728ljp.494.1607770646463; Sat, 12 Dec 2020 02:57:26 -0800 (PST) Received: from localhost.bredbandsbolaget (c-92d7225c.014-348-6c756e10.bbcust.telenor.se. [92.34.215.146]) by smtp.gmail.com with ESMTPSA id j2sm490674lfe.213.2020.12.12.02.57.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 12 Dec 2020 02:57:25 -0800 (PST) From: Linus Walleij To: Sebastian Reichel , Marcus Cooper Cc: linux-pm@vger.kernel.org, Linus Walleij Subject: [PATCH 5/5] power: supply: ab8500: Use dev_err_probe() for IIO channels Date: Sat, 12 Dec 2020 11:57:12 +0100 Message-Id: <20201212105712.2727842-6-linus.walleij@linaro.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20201212105712.2727842-1-linus.walleij@linaro.org> References: <20201212105712.2727842-1-linus.walleij@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org The code obtaining the ADC channels is outdated: it is trying to work around the IIO subsystem not returning the right -EPROBE_DEFER error code. Fix this up by using the dev_err_probe() helper so we defer silently where appropriate and not bail out if the IIO core returns -EPROBE_DEFER as happens now. Cc: Marcus Cooper Signed-off-by: Linus Walleij --- drivers/power/supply/ab8500_btemp.c | 14 +++++----- drivers/power/supply/ab8500_charger.c | 37 +++++++++++---------------- drivers/power/supply/ab8500_fg.c | 7 +++-- 3 files changed, 24 insertions(+), 34 deletions(-) -- 2.26.2 diff --git a/drivers/power/supply/ab8500_btemp.c b/drivers/power/supply/ab8500_btemp.c index 1f8fded47b2e..a9e53fe0244b 100644 --- a/drivers/power/supply/ab8500_btemp.c +++ b/drivers/power/supply/ab8500_btemp.c @@ -1023,17 +1023,15 @@ static int ab8500_btemp_probe(struct platform_device *pdev) /* Get ADC channels */ di->btemp_ball = devm_iio_channel_get(dev, "btemp_ball"); if (IS_ERR(di->btemp_ball)) { - if (PTR_ERR(di->btemp_ball) == -ENODEV) - return -EPROBE_DEFER; - dev_err(dev, "failed to get BTEMP BALL ADC channel\n"); - return PTR_ERR(di->btemp_ball); + ret = dev_err_probe(dev, PTR_ERR(di->btemp_ball), + "failed to get BTEMP BALL ADC channel\n"); + return ret; } di->bat_ctrl = devm_iio_channel_get(dev, "bat_ctrl"); if (IS_ERR(di->bat_ctrl)) { - if (PTR_ERR(di->bat_ctrl) == -ENODEV) - return -EPROBE_DEFER; - dev_err(dev, "failed to get BAT CTRL ADC channel\n"); - return PTR_ERR(di->bat_ctrl); + ret = dev_err_probe(dev, PTR_ERR(di->bat_ctrl), + "failed to get BAT CTRL ADC channel\n"); + return ret; } di->initialized = false; diff --git a/drivers/power/supply/ab8500_charger.c b/drivers/power/supply/ab8500_charger.c index d4b7bd68451b..ac77c8882d17 100644 --- a/drivers/power/supply/ab8500_charger.c +++ b/drivers/power/supply/ab8500_charger.c @@ -3375,36 +3375,29 @@ static int ab8500_charger_probe(struct platform_device *pdev) di->parent = dev_get_drvdata(pdev->dev.parent); /* Get ADC channels */ - di->adc_main_charger_v = devm_iio_channel_get(dev, - "main_charger_v"); + di->adc_main_charger_v = devm_iio_channel_get(dev, "main_charger_v"); if (IS_ERR(di->adc_main_charger_v)) { - if (PTR_ERR(di->adc_main_charger_v) == -ENODEV) - return -EPROBE_DEFER; - dev_err(dev, "failed to get ADC main charger voltage\n"); - return PTR_ERR(di->adc_main_charger_v); + ret = dev_err_probe(dev, PTR_ERR(di->adc_main_charger_v), + "failed to get ADC main charger voltage\n"); + return ret; } - di->adc_main_charger_c = devm_iio_channel_get(dev, - "main_charger_c"); + di->adc_main_charger_c = devm_iio_channel_get(dev, "main_charger_c"); if (IS_ERR(di->adc_main_charger_c)) { - if (PTR_ERR(di->adc_main_charger_c) == -ENODEV) - return -EPROBE_DEFER; - dev_err(dev, "failed to get ADC main charger current\n"); - return PTR_ERR(di->adc_main_charger_c); + ret = dev_err_probe(dev, PTR_ERR(di->adc_main_charger_c), + "failed to get ADC main charger current\n"); + return ret; } di->adc_vbus_v = devm_iio_channel_get(dev, "vbus_v"); if (IS_ERR(di->adc_vbus_v)) { - if (PTR_ERR(di->adc_vbus_v) == -ENODEV) - return -EPROBE_DEFER; - dev_err(dev, "failed to get ADC USB charger voltage\n"); - return PTR_ERR(di->adc_vbus_v); + ret = dev_err_probe(dev, PTR_ERR(di->adc_vbus_v), + "failed to get ADC USB charger voltage\n"); + return ret; } - di->adc_usb_charger_c = devm_iio_channel_get(dev, - "usb_charger_c"); + di->adc_usb_charger_c = devm_iio_channel_get(dev, "usb_charger_c"); if (IS_ERR(di->adc_usb_charger_c)) { - if (PTR_ERR(di->adc_usb_charger_c) == -ENODEV) - return -EPROBE_DEFER; - dev_err(dev, "failed to get ADC USB charger current\n"); - return PTR_ERR(di->adc_usb_charger_c); + ret = dev_err_probe(dev, PTR_ERR(di->adc_usb_charger_c), + "failed to get ADC USB charger current\n"); + return ret; } /* initialize lock */ diff --git a/drivers/power/supply/ab8500_fg.c b/drivers/power/supply/ab8500_fg.c index d1b68acac427..3873e4857e3d 100644 --- a/drivers/power/supply/ab8500_fg.c +++ b/drivers/power/supply/ab8500_fg.c @@ -3059,10 +3059,9 @@ static int ab8500_fg_probe(struct platform_device *pdev) di->main_bat_v = devm_iio_channel_get(dev, "main_bat_v"); if (IS_ERR(di->main_bat_v)) { - if (PTR_ERR(di->main_bat_v) == -ENODEV) - return -EPROBE_DEFER; - dev_err(dev, "failed to get main battery ADC channel\n"); - return PTR_ERR(di->main_bat_v); + ret = dev_err_probe(dev, PTR_ERR(di->main_bat_v), + "failed to get main battery ADC channel\n"); + return ret; } psy_cfg.supplied_to = supply_interface;