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); }