From patchwork Fri Nov 1 07:45:09 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 11222483 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8B5D513BD for ; Fri, 1 Nov 2019 07:45:27 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 5BA83208CB for ; Fri, 1 Nov 2019 07:45:27 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="OtvmazYa"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="tbCJuYLo" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5BA83208CB Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=ZUA6ZMSzSaeyKPZnq6AbzUSpwOTEa4wAEpvL9FNlLOs=; b=OtvmazYa1qgBLLJGHqUauCwtAl 06cKx0PRn3WtTYV5JjtYeK0mE16PWLdk2XuTD0mC7oNuy7aLjmtc1FG6i+o+cOijrKBKIuf0h0Xe4 WwKh1BJ/po9/VP0RQ3Q6HPUaIhxMe/rDO/uhdkt4ZEva2tL5WbrnwgHNCpbHFJ+8LJW9uLrNXkcix kO65cyQceTMyUDFdgEYZ6HmZnNCeEYnoltfqx6AlQb9M5XmCsfMT+sov8Mu0hy03/4Vjx7szIXF1C GopB5tCVt9udN9J5tFetGb+0Xh+baRXtrK+XL5ks+i15L7wJv7OdwMF6ySkW5GdguQuS+VNW44GpU c9LdqEog==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1iQRcc-00082v-VZ; Fri, 01 Nov 2019 07:45:26 +0000 Received: from mail-wr1-x441.google.com ([2a00:1450:4864:20::441]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1iQRcZ-00081W-Vv for linux-arm-kernel@lists.infradead.org; Fri, 01 Nov 2019 07:45:25 +0000 Received: by mail-wr1-x441.google.com with SMTP id o28so8790356wro.7 for ; Fri, 01 Nov 2019 00:45:23 -0700 (PDT) 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; bh=YZmXO5ePw27XXjmw9aqXqaRd2VOTfPGeZBWp3iFdesM=; b=tbCJuYLob+0SWNE/H/aeNZaYlGi3cJ/mzfR3bgtLr1RoF0bzCFs3kcYakZXCwCnEnd MnLJgV1VtNOLom7eF3xRGzmxN00x8pt3aNMSyx8IlHnxSN+vGoNCz8lnWXF/E2LeLRvn XuvG3bchUwfbZm8phPQsjEYu6akLSU2CDD+qS4olY3VNarH3zFRwoe+XEwYQbqJlBfzq tQ9kT8oAkB6fwztc9zSR4if6OpgunzPPqsW0tCdlEdG5uSZMnTh0Nv5cpGDx/fojiR1p 1zIVuPoGmrTObZd6uVv0z7p0Xg2J9lR6gL1Fj/BLXh7mzPJPAim6tOvqoSDnWlzZRh8C /1uQ== 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; bh=YZmXO5ePw27XXjmw9aqXqaRd2VOTfPGeZBWp3iFdesM=; b=NQD5GZxPoOH9cxLfTjJh5NGpgZMOTJEuvQsHbOaW/qBoOSqPo1SbHrLaA/2PbESWai 0+4m4aYIsiekK5GrBvanchK98GFJ4z0O1Ea1v8+lktstDBsM6Lx6+yh8Ybdn2wAVuqDO j+CeCffS/1nRXp60W8o7Jr8LvSVW5KUWcZyn+iXGLKm7Pp+YAftbqnvAPciTaomPVx4d WDYI/Sh9fmCu2OitgldK4dTchcQXBpTnimtJIvfQDZ/DzT5UR713C+3HT45vcbpFHLaJ y64D040046GHZKkkSuPOzMVyBE2yW7sn9G936E1eZ5Zj2UyWiNZfOuRC3i9M7rvXD+U1 yQOQ== X-Gm-Message-State: APjAAAXW1LfiIOU2oHOx6wphYBYB7YxYOfRHzIBgL/+Y3C5j5HWdlV0e O/fjXW4HKNH0rvKXGOSV8aXLLvUY790= X-Google-Smtp-Source: APXvYqzAhKI9QO7+uHq0jZZwhl3O0BW/SI4JcZ57GySMVZs/utC1/kufLJ8AWDWrDLnPbWRV/GVe2w== X-Received: by 2002:adf:eb48:: with SMTP id u8mr5175902wrn.225.1572594322417; Fri, 01 Nov 2019 00:45:22 -0700 (PDT) Received: from localhost.localdomain ([2.31.163.64]) by smtp.gmail.com with ESMTPSA id b1sm576215wrw.77.2019.11.01.00.45.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Nov 2019 00:45:21 -0700 (PDT) From: Lee Jones To: daniel.thompson@linaro.org, broonie@kernel.org Subject: [PATCH v4 01/10] mfd: cs5535-mfd: Use PLATFORM_DEVID_* defines and tidy error message Date: Fri, 1 Nov 2019 07:45:09 +0000 Message-Id: <20191101074518.26228-2-lee.jones@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191101074518.26228-1-lee.jones@linaro.org> References: <20191101074518.26228-1-lee.jones@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20191101_004524_028575_C10E91A5 X-CRM114-Status: GOOD ( 12.86 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:441 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: baohua@kernel.org, stephan@gerhold.net, arnd@arndb.de, linus.walleij@linaro.org, linux-kernel@vger.kernel.org, Lee Jones , linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org In most contexts '-1' doesn't really mean much to the casual observer. In almost all cases, it's better to use a human readable define. In this case PLATFORM_DEVID_* defines have already been provided for this purpose. While we're here, let's be specific about the 'MFD devices' which failed. It will help when trying to distinguish which of the 2 sets of sub-devices we actually failed to register. Signed-off-by: Lee Jones Reviewed-by: Daniel Thompson --- drivers/mfd/cs5535-mfd.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/mfd/cs5535-mfd.c b/drivers/mfd/cs5535-mfd.c index f1825c0ccbd0..cda7f5b942e7 100644 --- a/drivers/mfd/cs5535-mfd.c +++ b/drivers/mfd/cs5535-mfd.c @@ -127,10 +127,11 @@ static int cs5535_mfd_probe(struct pci_dev *pdev, cs5535_mfd_cells[i].id = 0; } - err = mfd_add_devices(&pdev->dev, -1, cs5535_mfd_cells, + err = mfd_add_devices(&pdev->dev, PLATFORM_DEVID_NONE, cs5535_mfd_cells, ARRAY_SIZE(cs5535_mfd_cells), NULL, 0, NULL); if (err) { - dev_err(&pdev->dev, "MFD add devices failed: %d\n", err); + dev_err(&pdev->dev, + "Failed to add CS5535 sub-devices: %d\n", err); goto err_disable; } From patchwork Fri Nov 1 07:45:10 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 11222487 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 3A35214DB for ; Fri, 1 Nov 2019 07:45:55 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id F0FB82080F for ; Fri, 1 Nov 2019 07:45:54 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="qVMpYDSE"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="vdGFsAjy" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org F0FB82080F Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=k+uryYCUA28pChAty7VAuKECSaFCYISucKJb8HpR6CU=; b=qVMpYDSEDwnoTEuWHoyPmyM2wa 5+wAPJMNMeq+wBpY0wumUDieGF3sJVXbY1POFBfp1mJW8Obzhe/w0RKGwKO1xEr7B+FMa8Ga4jXKS +HKkojfaXKXAAR3XigHH04wYqrk/iA3kvpPYpHgPvdsn+BNsVEibHtGl0D9kg1BIdTT8iGJu4u3vT /sJnDjBrm3rBYr9QuJfl7BxpHBary9FoqD+MXQ7HO261edhUAI2bP9Lt410FBURftoLw+JZQU6cwP khRfCrhCb7yX3auY02oK6lJGtQcczcgcWfu0Fnpo0qMHTK5eu9ca/dIieberWox0xekLpsGR/fkAZ 86fSC4Rg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1iQRd2-0008V0-5s; Fri, 01 Nov 2019 07:45:52 +0000 Received: from mail-wr1-x441.google.com ([2a00:1450:4864:20::441]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1iQRca-00081x-UF for linux-arm-kernel@lists.infradead.org; Fri, 01 Nov 2019 07:45:26 +0000 Received: by mail-wr1-x441.google.com with SMTP id n1so8796419wra.10 for ; Fri, 01 Nov 2019 00:45:24 -0700 (PDT) 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; bh=C/fpce4zj8Symqro3B0UUT4uQWdn48veRLNE2xUiEm4=; b=vdGFsAjypI0mSjBgOqNUooAp4m4MfQ3YHrTg00PdnnA9cGN40by+eWJugaNkshf/ZB KR3IFrZ6ysfOE0+XKewaL50A4TNjCAL7tv0Fsi0pIY1f86g/5nZkEKP085Tux1fMEM3Y kUDK9XDy5ceVyg+QvbSqg6AuLfDPqtWroZrgdR0WAx0L91cOQrcqgWdjIHErHpt4VXCS 4yHGTUCPWjz6TvOinw8pjau6F783yazcdNr+vFEpgamEysT4OqJ8ZL3O0y2usDFtAtww M34m9y7C+zIIeHrIkOF4qbE9xNou0Z3cBPGq/bUeLDmImLlg6fiOV/IofRdBOY0vepuW YXTA== 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; bh=C/fpce4zj8Symqro3B0UUT4uQWdn48veRLNE2xUiEm4=; b=razS8XUDDsv9TvfikzZ50adgUApcZKEKa2qfIhJQSDlnvcmEzKHRD2/m66yPF3Vg/7 cJpXTc4EbSQfnRzMNYy5DaXctvdEqMGfgb4Z5Onxe+gxb9AYyT+0jzUxoonS/LGPXy/v hyEAwGVaKSXNzrtIxDCKR9LTQC9yKB3rjIhS5R/+sVLB5/BkJ7C70zS8aYyxOwwXnkym dcFIoS6B2m4MFx2lK6/PepxPAUhklHgLpSyq5zMGFKR9sx7as2DQKmSw26pokgI9UYXy nbNhNhVt7nLf2Zvz22ZxGsVM57s+wMrYyTJl0HlIcK1U/dn6F+TbmdhTWv9lNy02+jxP YLrQ== X-Gm-Message-State: APjAAAXZxQWi52neus1H19MVUMTHoc5FYZGOpQ9RW5G3YUzrBzWo3j9M 3Zpq+cemjB+TPHUr00t9co19xDEbsOY= X-Google-Smtp-Source: APXvYqwq+F6gA3UQw8pVEhUfe9Xu39bSZwSSmj9CGYK4g86iUd/eJHgSykb2d4ooTXLkEUz4BlNDww== X-Received: by 2002:a5d:6944:: with SMTP id r4mr1938621wrw.238.1572594323745; Fri, 01 Nov 2019 00:45:23 -0700 (PDT) Received: from localhost.localdomain ([2.31.163.64]) by smtp.gmail.com with ESMTPSA id b1sm576215wrw.77.2019.11.01.00.45.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Nov 2019 00:45:23 -0700 (PDT) From: Lee Jones To: daniel.thompson@linaro.org, broonie@kernel.org Subject: [PATCH v4 02/10] mfd: cs5535-mfd: Remove mfd_cell->id hack Date: Fri, 1 Nov 2019 07:45:10 +0000 Message-Id: <20191101074518.26228-3-lee.jones@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191101074518.26228-1-lee.jones@linaro.org> References: <20191101074518.26228-1-lee.jones@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20191101_004524_976420_CF1908F6 X-CRM114-Status: GOOD ( 13.13 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:441 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: baohua@kernel.org, stephan@gerhold.net, arnd@arndb.de, linus.walleij@linaro.org, linux-kernel@vger.kernel.org, Lee Jones , linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org The current implementation abuses the platform 'id' mfd_cell member to index into the correct resources entry. Seeing as enough resource slots are already available, let's just loop through all available bars and allocate them to their appropriate slot, even if they happen to be zero. Signed-off-by: Lee Jones Reviewed-by: Daniel Thompson --- drivers/mfd/cs5535-mfd.c | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/drivers/mfd/cs5535-mfd.c b/drivers/mfd/cs5535-mfd.c index cda7f5b942e7..b35f1efa01f6 100644 --- a/drivers/mfd/cs5535-mfd.c +++ b/drivers/mfd/cs5535-mfd.c @@ -63,25 +63,21 @@ static struct resource cs5535_mfd_resources[NR_BARS]; static struct mfd_cell cs5535_mfd_cells[] = { { - .id = SMB_BAR, .name = "cs5535-smb", .num_resources = 1, .resources = &cs5535_mfd_resources[SMB_BAR], }, { - .id = GPIO_BAR, .name = "cs5535-gpio", .num_resources = 1, .resources = &cs5535_mfd_resources[GPIO_BAR], }, { - .id = MFGPT_BAR, .name = "cs5535-mfgpt", .num_resources = 1, .resources = &cs5535_mfd_resources[MFGPT_BAR], }, { - .id = PMS_BAR, .name = "cs5535-pms", .num_resources = 1, .resources = &cs5535_mfd_resources[PMS_BAR], @@ -90,7 +86,6 @@ static struct mfd_cell cs5535_mfd_cells[] = { .disable = cs5535_mfd_res_disable, }, { - .id = ACPI_BAR, .name = "cs5535-acpi", .num_resources = 1, .resources = &cs5535_mfd_resources[ACPI_BAR], @@ -108,23 +103,18 @@ static const char *olpc_acpi_clones[] = { static int cs5535_mfd_probe(struct pci_dev *pdev, const struct pci_device_id *id) { - int err, i; + int err, bar; err = pci_enable_device(pdev); if (err) return err; - /* fill in IO range for each cell; subdrivers handle the region */ - for (i = 0; i < ARRAY_SIZE(cs5535_mfd_cells); i++) { - int bar = cs5535_mfd_cells[i].id; + for (bar = 0; bar < NR_BARS; bar++) { struct resource *r = &cs5535_mfd_resources[bar]; r->flags = IORESOURCE_IO; r->start = pci_resource_start(pdev, bar); r->end = pci_resource_end(pdev, bar); - - /* id is used for temporarily storing BAR; unset it now */ - cs5535_mfd_cells[i].id = 0; } err = mfd_add_devices(&pdev->dev, PLATFORM_DEVID_NONE, cs5535_mfd_cells, From patchwork Fri Nov 1 07:45:11 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 11222489 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id DB06714DB for ; Fri, 1 Nov 2019 07:46:06 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 9A99421734 for ; Fri, 1 Nov 2019 07:46:06 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="SW4+RDsP"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="At9PfBtn" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9A99421734 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=TUwoX8/HFyhtv8FP42t+RotSmQWCj0ldRCAp+xB1Yr4=; b=SW4+RDsPVoEGcSVgNakIrNbSk8 1p/hm5LJouXGc9Uenh7ac7TnwzMkCytXEn8X0QmRUOfp2lJhN8eLndz9L+Yh/+g7GoFrJKBIg9KC5 fH5ptmSMbKGrTgabWnIMljQVQocipZWJaBQLzK3DABIE7dUaDJro3DgfE1ThOXMTVEbhxTTpYiDad 6ot7ZZZZ13H4oK5PwfdpTIU0EhYF6GCzsOLqm+JMdyVjHHaw/g9N1yZ7O39n637gTkXJrtCp8uT3P rNh9vJORXm6xPigD//yJgHQssGhoGtKYV2N3AloNQH/cE/Jj89qSoUBQQ8oRA6zsCG7qPFvQ14lw+ gxBxowEA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1iQRdF-0000HM-8P; Fri, 01 Nov 2019 07:46:05 +0000 Received: from mail-wm1-x343.google.com ([2a00:1450:4864:20::343]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1iQRcc-00082R-8O for linux-arm-kernel@lists.infradead.org; Fri, 01 Nov 2019 07:45:27 +0000 Received: by mail-wm1-x343.google.com with SMTP id c22so8254274wmd.1 for ; Fri, 01 Nov 2019 00:45:25 -0700 (PDT) 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; bh=YwP+Ou3x0Xq501y6yZMGhDxJBzedJFnXI45wlydnDjg=; b=At9PfBtnr200Qg5yCgwaj6cV7dJ1Xi6kY3lokTY5Um/mHszQ9tQ+oE0Fjdi27WE2t9 rhbGMrbX/WTBMw5kFNO9WoiX86d+KsjMX31m+b3OI4FhvnOqTDs1pzpNL8aH6R0lHkxW rIBOf0w6MlhnutR0f9HYYnStgyMhE5bsGFxKe5/b/SI+/PH5FXzb8DrcKt6+JlOYYBiA w7dk4wFw2cJGqmwTAuFVYf2F+WoOKbafPV8vZDGik639QE64nAb/ABYNof59zIsL8KNy +jmYlSanPX1wsWSZv1VeBm3REATgSbK1eJkuULXZAHIXHgTR5YEAHrOJjGoZm07HAkXw aWeA== 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; bh=YwP+Ou3x0Xq501y6yZMGhDxJBzedJFnXI45wlydnDjg=; b=N4uAS3XARW6sKemXK+aOG0qJFtMOqGx9n7o2lrqrzxqdIQRQT+4uH8d/sZjzNX7QG1 NAQqA044o27I4+u59LSTn1YV93hhBQKNZZQLxwRn/MQo2HT03GxOJxiS9VDhJMQhA3X9 xUC9fANAhTPT1stP5Vq7VVX0QXfmTpqHTJ2vs0Ghf4zhwSgxxaqn3ioMkhcqr2GccyOG P/YFLwwwVxpdMzlmoyM805qH9uX3X3CRBLSKGD+r2kOOmQXH1qIBjBRZ7DtrzccKh2MB iCMoiEGE+Gaw2bzeYU64Ptro79OSYQrQrEUEPKbTAIX8VLcPvtgDcl38WEfQmhxCKAjd uebA== X-Gm-Message-State: APjAAAUlRSO+O07niWR01Z0bJLGHUBHzpy9x7zF6s5o10GJlTqEXpSyw X91Q8AVAd2U2yDPXBF2Xvxuyig== X-Google-Smtp-Source: APXvYqwzG7xFGETqQwWZl8YIeOq/BmnWWaWF/NJEgC1YTqaXF15LUaWJSOUGpw0PnQpFretUd/rZGw== X-Received: by 2002:a7b:cb43:: with SMTP id v3mr8689669wmj.137.1572594324646; Fri, 01 Nov 2019 00:45:24 -0700 (PDT) Received: from localhost.localdomain ([2.31.163.64]) by smtp.gmail.com with ESMTPSA id b1sm576215wrw.77.2019.11.01.00.45.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Nov 2019 00:45:24 -0700 (PDT) From: Lee Jones To: daniel.thompson@linaro.org, broonie@kernel.org Subject: [PATCH v4 03/10] mfd: cs5535-mfd: Request shared IO regions centrally Date: Fri, 1 Nov 2019 07:45:11 +0000 Message-Id: <20191101074518.26228-4-lee.jones@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191101074518.26228-1-lee.jones@linaro.org> References: <20191101074518.26228-1-lee.jones@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20191101_004526_295511_CCCC09BE X-CRM114-Status: GOOD ( 15.74 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:343 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: baohua@kernel.org, stephan@gerhold.net, arnd@arndb.de, linus.walleij@linaro.org, linux-kernel@vger.kernel.org, Lee Jones , linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org Prior to this patch, IO regions were requested via an MFD subsytem-level .enable() call-back and similarly released by a .disable() call-back. Double requests/releases were avoided by a centrally handled usage count mechanism. This complexity can all be avoided by handling IO regions only once during .probe() and .remove() of the parent device. Since this is the only legitimate user of the aforementioned usage count mechanism, this patch will allow it to be removed from MFD core in subsequent steps. Suggested-by: Daniel Thompson Signed-off-by: Lee Jones Reviewed-by: Daniel Thompson --- drivers/mfd/cs5535-mfd.c | 74 ++++++++++++++++++---------------------- 1 file changed, 33 insertions(+), 41 deletions(-) diff --git a/drivers/mfd/cs5535-mfd.c b/drivers/mfd/cs5535-mfd.c index b35f1efa01f6..3b569b231510 100644 --- a/drivers/mfd/cs5535-mfd.c +++ b/drivers/mfd/cs5535-mfd.c @@ -27,38 +27,6 @@ enum cs5535_mfd_bars { NR_BARS, }; -static int cs5535_mfd_res_enable(struct platform_device *pdev) -{ - struct resource *res; - - res = platform_get_resource(pdev, IORESOURCE_IO, 0); - if (!res) { - dev_err(&pdev->dev, "can't fetch device resource info\n"); - return -EIO; - } - - if (!request_region(res->start, resource_size(res), DRV_NAME)) { - dev_err(&pdev->dev, "can't request region\n"); - return -EIO; - } - - return 0; -} - -static int cs5535_mfd_res_disable(struct platform_device *pdev) -{ - struct resource *res; - - res = platform_get_resource(pdev, IORESOURCE_IO, 0); - if (!res) { - dev_err(&pdev->dev, "can't fetch device resource info\n"); - return -EIO; - } - - release_region(res->start, resource_size(res)); - return 0; -} - static struct resource cs5535_mfd_resources[NR_BARS]; static struct mfd_cell cs5535_mfd_cells[] = { @@ -81,17 +49,11 @@ static struct mfd_cell cs5535_mfd_cells[] = { .name = "cs5535-pms", .num_resources = 1, .resources = &cs5535_mfd_resources[PMS_BAR], - - .enable = cs5535_mfd_res_enable, - .disable = cs5535_mfd_res_disable, }, { .name = "cs5535-acpi", .num_resources = 1, .resources = &cs5535_mfd_resources[ACPI_BAR], - - .enable = cs5535_mfd_res_enable, - .disable = cs5535_mfd_res_disable, }, }; @@ -117,22 +79,47 @@ static int cs5535_mfd_probe(struct pci_dev *pdev, r->end = pci_resource_end(pdev, bar); } + err = pci_request_region(pdev, PMS_BAR, DRV_NAME); + if (err) { + dev_err(&pdev->dev, "Failed to request PMS_BAR's IO region\n"); + goto err_disable; + } + err = mfd_add_devices(&pdev->dev, PLATFORM_DEVID_NONE, cs5535_mfd_cells, ARRAY_SIZE(cs5535_mfd_cells), NULL, 0, NULL); if (err) { dev_err(&pdev->dev, "Failed to add CS5535 sub-devices: %d\n", err); - goto err_disable; + goto err_release_pms; } - if (machine_is_olpc()) - mfd_clone_cell("cs5535-acpi", olpc_acpi_clones, ARRAY_SIZE(olpc_acpi_clones)); + if (machine_is_olpc()) { + err = pci_request_region(pdev, ACPI_BAR, DRV_NAME); + if (err) { + dev_err(&pdev->dev, + "Failed to request ACPI_BAR's IO region\n"); + goto err_remove_devices; + } + + err = mfd_clone_cell("cs5535-acpi", olpc_acpi_clones, + ARRAY_SIZE(olpc_acpi_clones)); + if (err) { + dev_err(&pdev->dev, "Failed to clone MFD cell\n"); + goto err_release_acpi; + } + } dev_info(&pdev->dev, "%zu devices registered.\n", ARRAY_SIZE(cs5535_mfd_cells)); return 0; +err_release_acpi: + pci_release_region(pdev, ACPI_BAR); +err_remove_devices: + mfd_remove_devices(&pdev->dev); +err_release_pms: + pci_release_region(pdev, PMS_BAR); err_disable: pci_disable_device(pdev); return err; @@ -141,6 +128,11 @@ static int cs5535_mfd_probe(struct pci_dev *pdev, static void cs5535_mfd_remove(struct pci_dev *pdev) { mfd_remove_devices(&pdev->dev); + + if (machine_is_olpc()) + pci_release_region(pdev, ACPI_BAR); + + pci_release_region(pdev, PMS_BAR); pci_disable_device(pdev); } From patchwork Fri Nov 1 07:45:12 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 11222491 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 399AF13BD for ; Fri, 1 Nov 2019 07:46:26 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 13F5D2080F for ; Fri, 1 Nov 2019 07:46:26 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="Mwrep6wX"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="NLpmXnv7" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 13F5D2080F Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=05XxNjEs981QXwlmagm6rm/y2oAxRWSVHeHlpdJPcio=; b=Mwrep6wXIf60Nxlfsgh9da9W03 YtpuPx6qRGTvy76C1bxfUHW5eOM8me47qdG4trzom1p9du6G6R/GYTWVxhcChFRXb09rarybhDt4N sfJFxRiPolUP8MprA1fpbQeBOxeI0R7ro0cqVKydWqn/gbKVflLtFj1Wolvl+bs3CafUkVjsfgD0r Bi57p9QXJk+Zc2tisiQIfvuf2PIGHxI7tgxGKUoyosP+L3CtCO+mrlI48HimuIu9mtrDcBmz5oqT/ zpMGqcDrQMh2Agg3kl6jKAVC/RfLNqi9wvVVZiPUY0fyYMXM0ljLKqGleo11P2E0lW3SUplz7e0Zb BSu4v43w==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1iQRdZ-0000bA-9M; Fri, 01 Nov 2019 07:46:25 +0000 Received: from mail-wm1-x343.google.com ([2a00:1450:4864:20::343]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1iQRcd-00082w-GE for linux-arm-kernel@lists.infradead.org; Fri, 01 Nov 2019 07:45:29 +0000 Received: by mail-wm1-x343.google.com with SMTP id w9so8234059wmm.5 for ; Fri, 01 Nov 2019 00:45:27 -0700 (PDT) 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; bh=o/WXNJ1LA673vdJ8sFOa/ninCgRnpi26dheEONfyqB0=; b=NLpmXnv7R42LKiqA47VpSnkRY8XSxT2H2FVSayMw/zkOdsQZzOkqdbPIQ/zqzCB0db y1kbqWP6t1ZUqf2oG8daRFBPtTfdlI0EhlkJjDINFp0R+3vik28XAfGFzUi/YcMLwbZ4 q5YudIUt0fOEXyeHJzEPJKZHIEheIL/Vl2oW2w92Bksv+d5sT+DP9vkVugFdl/uXBG0Z DTkzSlSAWby6oCttAgyuuRZpASHljJq6nuGd0k9KJ8HyDyz4Gad2Ni90RK5h/+fk+tfK Xxp5P3XYMA0CjrWLUpV8mIegqZNVrZgpJRxOU5z/h2T25UfZimy0TX/BlswzJX++KXp4 KvyQ== 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; bh=o/WXNJ1LA673vdJ8sFOa/ninCgRnpi26dheEONfyqB0=; b=icwGmk5HLja0qRZvATFOYL8agovkQyU4B2qA0sseBtoPG77RkwN3xI7wJQgKp8OG1n ESiH9A5X8onLXLiT4JXfNId7w7dJ8gnv2u4k+BeiUOEeBYNmJLpKduwEemCEBYt3tAKC u0BOUNt1oCONU/eQF6KMZHY2gbRVeXVxU7EzLZpqK36PduyBn1FOzqoINpZk7mhgnA/N bV7yjfZQb4ah5um6qeE2VfKWtv4ru/SGE3tyQjr3Ly3pjXjCcFhgPqdUvIMOKq1BfvEH QuHVL8dUt0XK06KNvcQLL5DB/mqDcKgbonYK/SXCDezVsNB5v4HHnNdug7WFaxjJ1L+1 weVg== X-Gm-Message-State: APjAAAUQLq72xZxN/RaxeYjNpKJI6e/Dq+KveH9IXfm4TDyWWdC8qVIl 4JL3+bxneqLkglu5S4zihv1xWw== X-Google-Smtp-Source: APXvYqxrp51r0BToycxLzs+62ME/8nCKs9NXgANVP3qglKRs+XlWI6yZaUm8W6tBL1BpnBLsbC2Slg== X-Received: by 2002:a1c:5f04:: with SMTP id t4mr8374156wmb.23.1572594326248; Fri, 01 Nov 2019 00:45:26 -0700 (PDT) Received: from localhost.localdomain ([2.31.163.64]) by smtp.gmail.com with ESMTPSA id b1sm576215wrw.77.2019.11.01.00.45.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Nov 2019 00:45:25 -0700 (PDT) From: Lee Jones To: daniel.thompson@linaro.org, broonie@kernel.org Subject: [PATCH v4 04/10] mfd: cs5535-mfd: Register clients using their own dedicated MFD cell entries Date: Fri, 1 Nov 2019 07:45:12 +0000 Message-Id: <20191101074518.26228-5-lee.jones@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191101074518.26228-1-lee.jones@linaro.org> References: <20191101074518.26228-1-lee.jones@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20191101_004527_552587_B75DB5B1 X-CRM114-Status: GOOD ( 13.49 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:343 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: baohua@kernel.org, stephan@gerhold.net, arnd@arndb.de, linus.walleij@linaro.org, linux-kernel@vger.kernel.org, Lee Jones , linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org CS5535 is the only user of mfd_clone_cell(). It makes more sense to register child devices in the traditional way and remove the quite bespoke mfd_clone_cell() call from the MFD API. Signed-off-by: Lee Jones Reviewed-by: Daniel Thompson --- drivers/mfd/cs5535-mfd.c | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/drivers/mfd/cs5535-mfd.c b/drivers/mfd/cs5535-mfd.c index 3b569b231510..d0fb2e52ee76 100644 --- a/drivers/mfd/cs5535-mfd.c +++ b/drivers/mfd/cs5535-mfd.c @@ -50,16 +50,19 @@ static struct mfd_cell cs5535_mfd_cells[] = { .num_resources = 1, .resources = &cs5535_mfd_resources[PMS_BAR], }, +}; + +static struct mfd_cell cs5535_olpc_mfd_cells[] = { { - .name = "cs5535-acpi", + .name = "olpc-xo1-pm-acpi", + .num_resources = 1, + .resources = &cs5535_mfd_resources[ACPI_BAR], + }, + { + .name = "olpc-xo1-sci-acpi", .num_resources = 1, .resources = &cs5535_mfd_resources[ACPI_BAR], }, -}; - -static const char *olpc_acpi_clones[] = { - "olpc-xo1-pm-acpi", - "olpc-xo1-sci-acpi" }; static int cs5535_mfd_probe(struct pci_dev *pdev, @@ -101,10 +104,14 @@ static int cs5535_mfd_probe(struct pci_dev *pdev, goto err_remove_devices; } - err = mfd_clone_cell("cs5535-acpi", olpc_acpi_clones, - ARRAY_SIZE(olpc_acpi_clones)); + err = mfd_add_devices(&pdev->dev, PLATFORM_DEVID_NONE, + cs5535_olpc_mfd_cells, + ARRAY_SIZE(cs5535_olpc_mfd_cells), + NULL, 0, NULL); if (err) { - dev_err(&pdev->dev, "Failed to clone MFD cell\n"); + dev_err(&pdev->dev, + "Failed to add CS5535 OLPC sub-devices: %d\n", + err); goto err_release_acpi; } } From patchwork Fri Nov 1 07:45:13 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 11222493 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6D64A13BD for ; Fri, 1 Nov 2019 07:46:41 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 165452080F for ; Fri, 1 Nov 2019 07:46:41 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="LkwdIE/L"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="aPAUMhk6" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 165452080F Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=an/2T8AbfBakU0H8KCpRfmHS+0u3m4+VOGaQYgaWOUA=; b=LkwdIE/LwN1FWj2cY56jgcUJJ5 l0AOXHd1VYfCAog15u80ZD/oId6DLtWT9a+CzNwtJMBP2OoICHHuOC/ZXbiGmHZNniYXRWv7Kq1ko cW3z7FB7Kcd69PHe+tpt1v92cpMPmN1m392jQH6Tc4Gwk7bwncwUKXjaTZ3+k3v/tCEZJUEOjisJ/ cvviLxHWu3UuAM0yoIPZwKvAL9cuKbUEWG9VTm+La+KgmMfJjjUaN47MP9gHBBAv5oh7zND0OC+UX j71BNmX542XgvCrM86opMaUgCYv/XsHo1L5dv7pEN8B+BRFOJ0V8D3jnu/ZnUXU8ytPocqw/IlGKG m3jrPNjA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1iQRdm-0000ok-Pv; Fri, 01 Nov 2019 07:46:38 +0000 Received: from mail-wm1-x343.google.com ([2a00:1450:4864:20::343]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1iQRce-00084r-VV for linux-arm-kernel@lists.infradead.org; Fri, 01 Nov 2019 07:45:30 +0000 Received: by mail-wm1-x343.google.com with SMTP id q130so8242065wme.2 for ; Fri, 01 Nov 2019 00:45:28 -0700 (PDT) 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; bh=GReEFG2GWwJjsYxj+qnWr2ZeJ1W345Xh+fZqhg0GuOc=; b=aPAUMhk6ayoWZyrvs0fsQnUU17xXjJv6voGdabNYsT7kPSp8UW342XBwFG/EeCKz0M 9HsX/Ldh/pDdk8lDjcmMli0SNg0TYdag8vMTj25aA78BvXaLqt9Cip7XMGccXX3djbMt f5T+xevpesx2ybGhZaHvyv/4lfHjcQ8WKL17xX0pbqQCYyF5U7q2oaX4MLyl5liN0hHz CQpfRklQ5z2fEf9l34Dg4zNLAGIIvGG8s0970wnbzNziW5bYYqeUboSChFg21DExUJgn MmSriuu9eSFRucviBK0WmT8DoZUToeM4JmB7oRR+ek1UV/IoV6ueW0DXiGuiCb9GxbAb /5uQ== 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; bh=GReEFG2GWwJjsYxj+qnWr2ZeJ1W345Xh+fZqhg0GuOc=; b=K6aJKmA9C9O46FbxMI+r1E4mTNZoZ5It3jhX6j4vUECrcZcVjzfSmCkLFTkB8K0/8a qt63jFVyn0Rd19l6RSGTNZ30bM+pbJWyukC2CbeDJep80R9MxbRVad3Fh5jGERiIhLMH ePgG4bcfsFAkOubInXDhZHTWmztPQJjCGOWwznZQWDkRI5hwg17NvSw2KBBSXkMngiA8 +8+3kKL1eyR+vZ/IxqrWowCfjOzO2ncmKs++oLD/bC6X9R0Caf8Sxhhze38+ZBGZjng+ LKx8YdMdSEcikYZW9p8nwa4tL5c7l/+VaUmYD6ZkngT7nIyN6PlzWslDnIkNluBQd3+q iWBQ== X-Gm-Message-State: APjAAAX7OlY0xXlP/jHfIxyhjlmZ5J4Z2QeMpDWTX3pLQUPD/wY53CKQ gGtxsHTM6ieQ+y7CTt3PPT1Uhg== X-Google-Smtp-Source: APXvYqxqiXxfND79tU2euKm70y8ndsR62OXKUOIdUDdm+VT6d6erzdd+NNvtgc9PKa8pxvqTSzxBnQ== X-Received: by 2002:a1c:808d:: with SMTP id b135mr8624500wmd.175.1572594327746; Fri, 01 Nov 2019 00:45:27 -0700 (PDT) Received: from localhost.localdomain ([2.31.163.64]) by smtp.gmail.com with ESMTPSA id b1sm576215wrw.77.2019.11.01.00.45.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Nov 2019 00:45:27 -0700 (PDT) From: Lee Jones To: daniel.thompson@linaro.org, broonie@kernel.org Subject: [PATCH v4 05/10] mfd: mfd-core: Protect against NULL call-back function pointer Date: Fri, 1 Nov 2019 07:45:13 +0000 Message-Id: <20191101074518.26228-6-lee.jones@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191101074518.26228-1-lee.jones@linaro.org> References: <20191101074518.26228-1-lee.jones@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20191101_004529_123905_13522342 X-CRM114-Status: GOOD ( 13.60 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:343 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: baohua@kernel.org, stephan@gerhold.net, arnd@arndb.de, linus.walleij@linaro.org, linux-kernel@vger.kernel.org, Lee Jones , linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org If a child device calls mfd_cell_{en,dis}able() without an appropriate call-back being set, we are likely to encounter a panic. Avoid this by adding suitable checking. Signed-off-by: Lee Jones Reviewed-by: Daniel Thompson Reviewed-by: Mark Brown --- drivers/mfd/mfd-core.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/mfd/mfd-core.c b/drivers/mfd/mfd-core.c index 23276a80e3b4..96d02b6f06fd 100644 --- a/drivers/mfd/mfd-core.c +++ b/drivers/mfd/mfd-core.c @@ -28,6 +28,11 @@ int mfd_cell_enable(struct platform_device *pdev) const struct mfd_cell *cell = mfd_get_cell(pdev); int err = 0; + if (!cell->enable) { + dev_dbg(&pdev->dev, "No .enable() call-back registered\n"); + return 0; + } + /* only call enable hook if the cell wasn't previously enabled */ if (atomic_inc_return(cell->usage_count) == 1) err = cell->enable(pdev); @@ -45,6 +50,11 @@ int mfd_cell_disable(struct platform_device *pdev) const struct mfd_cell *cell = mfd_get_cell(pdev); int err = 0; + if (!cell->disable) { + dev_dbg(&pdev->dev, "No .disable() call-back registered\n"); + return 0; + } + /* only disable if no other clients are using it */ if (atomic_dec_return(cell->usage_count) == 0) err = cell->disable(pdev); From patchwork Fri Nov 1 07:45:14 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 11222495 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id CDB2613BD for ; Fri, 1 Nov 2019 07:47:01 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A95912080F for ; Fri, 1 Nov 2019 07:47:01 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="rkDGZ+yo"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="B6R+1JCS" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A95912080F Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=v2waBVPfp5c2ik/OCFAq8xajzl9e7GLN7o64dTCXOyg=; b=rkDGZ+yoXE729LKZYQsTlTFIVr hI/YXmla0no/bIbRjwkcCVQHO+Hidab6y6A2bhcMGWE4vGlXBgra3BcL40zUBtDm4BdIHhHDl/lYj dzxxGnHVZm7VZV9K3a0w8wUzuRsrgkGRR3T/D/SBYP8gpU0gZIOvjAquYbMOKHOn/dnnlh3twciqs B175mAr4EmAY9YBHWcUTzS/iHGmHlgRnBt7QRLDVgoOPlEfCO71wpEXf09gfGAq6TJA8hCrZEbouc IYdtc3pdOzZjz16OkZQQAJRzxzKOs5EDHjyJY0w4ff7ftS3ELlzfLOcA8k7wYif7TGqN6iiN6AK+h KOsiXn4Q==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1iQRe1-00012u-Ow; Fri, 01 Nov 2019 07:46:53 +0000 Received: from mail-wr1-x442.google.com ([2a00:1450:4864:20::442]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1iQRcf-00086N-Ts for linux-arm-kernel@lists.infradead.org; Fri, 01 Nov 2019 07:45:31 +0000 Received: by mail-wr1-x442.google.com with SMTP id b3so3019437wrs.13 for ; Fri, 01 Nov 2019 00:45:29 -0700 (PDT) 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; bh=n8Ucez02iItku1JzTTgA4X0TOQF7g37QZ5FK6iQhubQ=; b=B6R+1JCSAwgKyR+aoys7iRUcEXhF3L/eli9PKppCN67iGTa5dHpuJBYW8X2vtxWRJe V7wTxydHk4Ct8YvnSw2UcLuTwXtjjbLQ666IT3NUpkXd5O1k08xxXtaEZwTcY64P7ngp +dpgTwiVaWNesy6RsktWd0EzF2wbkDF/rHJsF9tCQRKmKZi/3eYjzK4erdj7rbfyICJC jk6Jvl6IzMdWBLl8ebqJodEwDq8zVW63CGjUcX+SY0YJCfTuHzcxc4gMLkgx1Cf8ZrAa mUjSsKuDsvrttJrGmFIvqY8i6iPQPLpTQtCbWumn6yv6GTf5KqGthZt2jhVOdnHk/oRz G50Q== 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; bh=n8Ucez02iItku1JzTTgA4X0TOQF7g37QZ5FK6iQhubQ=; b=FsjxXsNlbz48TjUj1TDiES3dhwtbO++WnisdH+nE8hSGOAD3JBkZRxgP3Qu3dLPFAP Ru9EPpkOyWce2E7AmvuxqajWqMjJOlU1e+HYzHOzrJWxEREZJrBznBu8qWD48cjt+DnT PAwcaExD2d6Fq30Fh8xYe7v7GLRLGG7kIAf4RsG1ldvuF2zYqveRIlRG2bEcn0vJVe4u O4SgI8XGC/Ey9oeyjiH9RXWFwo/IIFJ5aNMV8S1xBOhWJKrXftmBlOF7BNUk67wPnySA icyY72XrvU/iLEHpNA31WYekCW5kNxfisG3forHwWgLB56PVNOWpKICgy59WHVaYKrNj uW8w== X-Gm-Message-State: APjAAAXWahqiNYZWBHQgsrzYahjFR+6f+ThgKQSpoigoh8s7eNqa7ELP 4ywaGsgsCOrCaH0OjfG/kbJFbQ== X-Google-Smtp-Source: APXvYqyKsKbyPv0zQ3Ni6kKILb9D2GUOzJUzrwbEAhG0ONH4/fOkO9nO+pmIrK6g7PN7ao0thJ1obA== X-Received: by 2002:adf:fe90:: with SMTP id l16mr9255966wrr.81.1572594328646; Fri, 01 Nov 2019 00:45:28 -0700 (PDT) Received: from localhost.localdomain ([2.31.163.64]) by smtp.gmail.com with ESMTPSA id b1sm576215wrw.77.2019.11.01.00.45.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Nov 2019 00:45:28 -0700 (PDT) From: Lee Jones To: daniel.thompson@linaro.org, broonie@kernel.org Subject: [PATCH v4 06/10] mfd: mfd-core: Remove mfd_clone_cell() Date: Fri, 1 Nov 2019 07:45:14 +0000 Message-Id: <20191101074518.26228-7-lee.jones@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191101074518.26228-1-lee.jones@linaro.org> References: <20191101074518.26228-1-lee.jones@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20191101_004529_970804_B50B900B X-CRM114-Status: GOOD ( 13.34 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:442 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: baohua@kernel.org, stephan@gerhold.net, arnd@arndb.de, linus.walleij@linaro.org, linux-kernel@vger.kernel.org, Lee Jones , linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org Providing a subsystem-level API helper seems over-kill just to save a few lines of C-code. Previous commits saw us convert mfd_clone_cell()'s only user over to use a more traditional style of MFD child-device registration. Now we can remove the superfluous helper from the MFD API. Signed-off-by: Lee Jones Reviewed-by: Daniel Thompson --- drivers/mfd/mfd-core.c | 33 --------------------------------- include/linux/mfd/core.h | 18 ------------------ 2 files changed, 51 deletions(-) diff --git a/drivers/mfd/mfd-core.c b/drivers/mfd/mfd-core.c index 96d02b6f06fd..e38e411ca775 100644 --- a/drivers/mfd/mfd-core.c +++ b/drivers/mfd/mfd-core.c @@ -392,38 +392,5 @@ int devm_mfd_add_devices(struct device *dev, int id, } EXPORT_SYMBOL(devm_mfd_add_devices); -int mfd_clone_cell(const char *cell, const char **clones, size_t n_clones) -{ - struct mfd_cell cell_entry; - struct device *dev; - struct platform_device *pdev; - int i; - - /* fetch the parent cell's device (should already be registered!) */ - dev = bus_find_device_by_name(&platform_bus_type, NULL, cell); - if (!dev) { - printk(KERN_ERR "failed to find device for cell %s\n", cell); - return -ENODEV; - } - pdev = to_platform_device(dev); - memcpy(&cell_entry, mfd_get_cell(pdev), sizeof(cell_entry)); - - WARN_ON(!cell_entry.enable); - - for (i = 0; i < n_clones; i++) { - cell_entry.name = clones[i]; - /* don't give up if a single call fails; just report error */ - if (mfd_add_device(pdev->dev.parent, -1, &cell_entry, - cell_entry.usage_count, NULL, 0, NULL)) - dev_err(dev, "failed to create platform device '%s'\n", - clones[i]); - } - - put_device(dev); - - return 0; -} -EXPORT_SYMBOL(mfd_clone_cell); - MODULE_LICENSE("GPL"); MODULE_AUTHOR("Ian Molton, Dmitry Baryshkov"); diff --git a/include/linux/mfd/core.h b/include/linux/mfd/core.h index b43fc5773ad7..bd8c0e089164 100644 --- a/include/linux/mfd/core.h +++ b/include/linux/mfd/core.h @@ -86,24 +86,6 @@ struct mfd_cell { extern int mfd_cell_enable(struct platform_device *pdev); extern int mfd_cell_disable(struct platform_device *pdev); -/* - * "Clone" multiple platform devices for a single cell. This is to be used - * for devices that have multiple users of a cell. For example, if an mfd - * driver wants the cell "foo" to be used by a GPIO driver, an MTD driver, - * and a platform driver, the following bit of code would be use after first - * calling mfd_add_devices(): - * - * const char *fclones[] = { "foo-gpio", "foo-mtd" }; - * err = mfd_clone_cells("foo", fclones, ARRAY_SIZE(fclones)); - * - * Each driver (MTD, GPIO, and platform driver) would then register - * platform_drivers for "foo-mtd", "foo-gpio", and "foo", respectively. - * The cell's .enable/.disable hooks should be used to deal with hardware - * resource contention. - */ -extern int mfd_clone_cell(const char *cell, const char **clones, - size_t n_clones); - /* * Given a platform device that's been created by mfd_add_devices(), fetch * the mfd_cell that created it. From patchwork Fri Nov 1 07:45:15 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 11222497 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id EBA7A13BD for ; Fri, 1 Nov 2019 07:47:08 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A9B02208CB for ; Fri, 1 Nov 2019 07:47:08 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="e2SCVdX4"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="SWoRZn1T" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A9B02208CB Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=hLNo1lDkTM85gOGUk5JoS/eQN+C6AiUazePNGnyEMK4=; b=e2SCVdX41V0RADmK/Qa5Y2S+gq ugZbjY5QhHXwTE4a2PtlRKP/U/yeEk7+AQBQgOT6z3DCIIHklrBSwupT0XjJyqrOpYjl3XPVq36Yl 0Zf7X5HMBTCjweC02HcSVcAU4Dybqq4bxkmPYvaq5plmDyncwVpKj/S8a0aGUm7wEGdqqSE0I96hk 1ursfj3QYsHYPQcOnyne6oGS1HkQLDVE5PasDHw2c9aAx/XSK+FTlmrNjgJ8MVCGajIUpHpC0ZTHs qwv7IIbItdei6TVnClHe3tHq8VixRx6VPoMKyFlYzUI8DWetQcU6tcnYNimwDb0GPI8NMHFnkAmmU rGG5QrbA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1iQReE-0001Gw-Du; Fri, 01 Nov 2019 07:47:06 +0000 Received: from mail-wr1-x444.google.com ([2a00:1450:4864:20::444]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1iQRch-00087p-D8 for linux-arm-kernel@lists.infradead.org; Fri, 01 Nov 2019 07:45:32 +0000 Received: by mail-wr1-x444.google.com with SMTP id e6so6972125wrw.1 for ; Fri, 01 Nov 2019 00:45:30 -0700 (PDT) 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; bh=I+jRYJ+sv8PSuO5nB4vni872MPFD94JrjqUMD7lrsKg=; b=SWoRZn1TJzuIfLyY1vbC2tQKk7pxk2GocVuGBSqprOkpeT/3QhldJootnOYUFiUoCW gffwSB1PUQOvQUhc2IycslRcwMVtl0OGCyKY0JVj/7TY2tCwLsJ7NLKuo6qX/6e99LH+ EpUyQKZrmnfU0fxcYD5J8438Ap+OkYn1pfEIt4AwNc+nu+Q+JDNuETpOqdH/IO3Frftf AX0sEGoxCggCDq9ru0P8HsrzgbWjCYKktoN/oIUKG9DUzGDxeiSFH565yAseyidSK+s4 MdmyH8jZckm8ulA1RFijtPeSaxbpDU+Kk56RJq5tAF/riUxZchUB1MBrz1uJdPhjr6wh e+cg== 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; bh=I+jRYJ+sv8PSuO5nB4vni872MPFD94JrjqUMD7lrsKg=; b=meJku22wMobGo0tL7oIu63n1WeTloyYmZV8dzglVoxuNEv40edYsFjFJrSHfWF2tBI S1N2TK/tzFsvhMIp1bYClm79JVBH+NqL3U6NmZj8hloQrDKE23SCL7G3zSXANrh19mYI NCt7wW+vF3z4gwBHPd43YbNxTbCdV63ipmLUc3n1j8IRg2j5MWLzUBoP4EqfDUh2ad9n dAht994CKPnr1wfTUdPvmM8jgpnaoqahoTegjz2nfC9PMGNKnX9HC7a3+Rhq1V9pC70z g+qx+M8m/LHperL7PRMCb4Ha3aHi328s4Fn8RCUR06/o3g3y9nObAn3ttW32jnptl+/Z iqtA== X-Gm-Message-State: APjAAAWi/iHJz0IXL7WizCzOIiue1M72LUMHLRrjlUayDkJbQQJIo4VE 5T8zERHuxSEWulH+Hv9vxjUsMQ== X-Google-Smtp-Source: APXvYqxrCw7zoPnntyf1vR3z7pJtOfHwiCDB2D5feX67g3arLBjDWeXDbRLO8m4RaC53pOLD3sb7Bw== X-Received: by 2002:adf:9dca:: with SMTP id q10mr9394442wre.183.1572594329634; Fri, 01 Nov 2019 00:45:29 -0700 (PDT) Received: from localhost.localdomain ([2.31.163.64]) by smtp.gmail.com with ESMTPSA id b1sm576215wrw.77.2019.11.01.00.45.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Nov 2019 00:45:29 -0700 (PDT) From: Lee Jones To: daniel.thompson@linaro.org, broonie@kernel.org Subject: [PATCH v4 07/10] x86: olpc-xo1-pm: Remove invocation of MFD's .enable()/.disable() call-backs Date: Fri, 1 Nov 2019 07:45:15 +0000 Message-Id: <20191101074518.26228-8-lee.jones@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191101074518.26228-1-lee.jones@linaro.org> References: <20191101074518.26228-1-lee.jones@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20191101_004531_455396_F614C0AA X-CRM114-Status: GOOD ( 11.44 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:444 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: baohua@kernel.org, stephan@gerhold.net, arnd@arndb.de, linus.walleij@linaro.org, linux-kernel@vger.kernel.org, Lee Jones , linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org IO regions are now requested and released by this device's parent. Signed-off-by: Lee Jones Reviewed-by: Daniel Thompson --- arch/x86/platform/olpc/olpc-xo1-pm.c | 8 -------- 1 file changed, 8 deletions(-) diff --git a/arch/x86/platform/olpc/olpc-xo1-pm.c b/arch/x86/platform/olpc/olpc-xo1-pm.c index e1a32062a375..f067ac780ba7 100644 --- a/arch/x86/platform/olpc/olpc-xo1-pm.c +++ b/arch/x86/platform/olpc/olpc-xo1-pm.c @@ -12,7 +12,6 @@ #include #include #include -#include #include #include @@ -120,16 +119,11 @@ static const struct platform_suspend_ops xo1_suspend_ops = { static int xo1_pm_probe(struct platform_device *pdev) { struct resource *res; - int err; /* don't run on non-XOs */ if (!machine_is_olpc()) return -ENODEV; - err = mfd_cell_enable(pdev); - if (err) - return err; - res = platform_get_resource(pdev, IORESOURCE_IO, 0); if (!res) { dev_err(&pdev->dev, "can't fetch device resource info\n"); @@ -152,8 +146,6 @@ static int xo1_pm_probe(struct platform_device *pdev) static int xo1_pm_remove(struct platform_device *pdev) { - mfd_cell_disable(pdev); - if (strcmp(pdev->name, "cs5535-pms") == 0) pms_base = 0; else if (strcmp(pdev->name, "olpc-xo1-pm-acpi") == 0) From patchwork Fri Nov 1 07:45:16 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 11222499 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4B7A913BD for ; Fri, 1 Nov 2019 07:47:20 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 0272D208CB for ; Fri, 1 Nov 2019 07:47:20 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="h+uOdho5"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="qbHXVYhy" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0272D208CB Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=chdSPjqTZUM87vfLzLqQkZrn2aqpBQEqYy2CSpug8Jg=; b=h+uOdho5lP55C/9kZWtFUpMEU+ Q38S2ZZD9LgcEWdX90PFO3VGIJx4zdV+x7Q7PDZA7ylw5r5sJW6gsG6m39gmFQ4AVgmf5XI/muKZ0 XRNTqJST3jMxufjRhCBSf6hLi98xDU9Tj84wsjr0SAphnHGShKw6PzQYYKK8y3vg5YdcJBI4+0DeR 5xNMvlp2Fzoru0HolWHIwUciPDYR3+04CZWhFSZIiojuxLEB2u6m3KU1vFo4FbUfefvQhEsVc5v3f IKUY8Ou9L0wUgzHuqHF5XvL2uKqu47hoAYd7a1mnqXmSHwD9FA2jE9I1Bg/5LWZG26Hs/NqNYa6II 4MDmb4uQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1iQReQ-0001UJ-G1; Fri, 01 Nov 2019 07:47:18 +0000 Received: from mail-wr1-x441.google.com ([2a00:1450:4864:20::441]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1iQRch-00088a-UF for linux-arm-kernel@lists.infradead.org; Fri, 01 Nov 2019 07:45:33 +0000 Received: by mail-wr1-x441.google.com with SMTP id v9so8814114wrq.5 for ; Fri, 01 Nov 2019 00:45:31 -0700 (PDT) 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; bh=BF4ZzyUEGnGEiyqA1v3l5l4pjBuYXhzsNNXXOYP8w+o=; b=qbHXVYhy5UqqBLj8qTiPohKa/wHistzi1bos518nV9bTNsteO8GyV6wzqHtSV3HuDM L2SOVq0KsobRYwXQzm6Dhi9BtAveaD3ISRF3m6M/ZDS1J3WuAV64hWlBbBsnoNjOkCUK Nbr2QDhq21lEZDWQWAPGh8ymfd/spSRc11zEeIX+Rd5tJknLhiLYpw156XiJc7n9nob1 UX1ZwMymHYKPyB61tOF9yGHL4CSezawT6ynfWSJpnXp2HLYjFprBeL49Q/4snQusirgI akUFjZspQxQTHfoDAbT/W+7pHIOCA9CqSmwWBDFOAxYLMeuANTYzqIQkUvKDJjjyGIvP e+EA== 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; bh=BF4ZzyUEGnGEiyqA1v3l5l4pjBuYXhzsNNXXOYP8w+o=; b=PfZ6usNsbvK02hJeTr0P6/7rUQm9g4z1256Nfyl0PrWAQ0PDBJs7PPEAh0cY/IsU0r c56O0jWwZquq6qHSB36ne8RhyOwejPd4tsY0YNPIhpOX9SA1rJAMN2E1JLz1i8dovgq4 viD5GhCFD7i2BsD1McnWUW5ml4bDi53F7PO7elzVweg9kh0SX1l5ZYLT0OpxyfsN0BgA teD5YvvV/kA9jTn4TZw7Kv2WE/HmBwCEal90Qu8QCfmm/FL/fBYIALn+uAP7NrisJFwf CG4zW2srfkg/os62V5sI4YsHV9hBaszbnJxFPQf3fWA+4SdeaOM1RuCMx+ubqHVvoZg2 ElHw== X-Gm-Message-State: APjAAAVe6eDnY1oLTnxdo6tO0gUst5klAnQfJVWH6eOeAI93Rkj+plhF rKSWww7LzjKHpzHM5dyfolevS6Mc1gM= X-Google-Smtp-Source: APXvYqwvChONErf1MGvp3rwWM4e47/N3o1hXnkEwYm9gxhom71/bEau2KdWY0ksYlxUM0IhOu12U4g== X-Received: by 2002:a05:6000:1601:: with SMTP id u1mr9321793wrb.214.1572594330472; Fri, 01 Nov 2019 00:45:30 -0700 (PDT) Received: from localhost.localdomain ([2.31.163.64]) by smtp.gmail.com with ESMTPSA id b1sm576215wrw.77.2019.11.01.00.45.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Nov 2019 00:45:29 -0700 (PDT) From: Lee Jones To: daniel.thompson@linaro.org, broonie@kernel.org Subject: [PATCH v4 08/10] x86: olpc-xo1-sci: Remove invocation of MFD's .enable()/.disable() call-backs Date: Fri, 1 Nov 2019 07:45:16 +0000 Message-Id: <20191101074518.26228-9-lee.jones@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191101074518.26228-1-lee.jones@linaro.org> References: <20191101074518.26228-1-lee.jones@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20191101_004532_017534_71ABEA3B X-CRM114-Status: GOOD ( 10.73 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:441 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: baohua@kernel.org, stephan@gerhold.net, arnd@arndb.de, linus.walleij@linaro.org, linux-kernel@vger.kernel.org, Lee Jones , linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org IO regions are now requested and released by this device's parent. Signed-off-by: Lee Jones Reviewed-by: Daniel Thompson --- arch/x86/platform/olpc/olpc-xo1-sci.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/arch/x86/platform/olpc/olpc-xo1-sci.c b/arch/x86/platform/olpc/olpc-xo1-sci.c index 99a28ce2244c..933dd4fe3a97 100644 --- a/arch/x86/platform/olpc/olpc-xo1-sci.c +++ b/arch/x86/platform/olpc/olpc-xo1-sci.c @@ -15,7 +15,6 @@ #include #include #include -#include #include #include #include @@ -537,10 +536,6 @@ static int xo1_sci_probe(struct platform_device *pdev) if (!machine_is_olpc()) return -ENODEV; - r = mfd_cell_enable(pdev); - if (r) - return r; - res = platform_get_resource(pdev, IORESOURCE_IO, 0); if (!res) { dev_err(&pdev->dev, "can't fetch device resource info\n"); @@ -605,7 +600,6 @@ static int xo1_sci_probe(struct platform_device *pdev) static int xo1_sci_remove(struct platform_device *pdev) { - mfd_cell_disable(pdev); free_irq(sci_irq, pdev); cancel_work_sync(&sci_work); free_ec_sci(); From patchwork Fri Nov 1 07:45:17 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 11222503 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8EB6714DB for ; Fri, 1 Nov 2019 07:47:57 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 60C3A2080F for ; Fri, 1 Nov 2019 07:47:57 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="glksZFB1"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="LKOGWnyZ" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 60C3A2080F Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=cVKTY/Nk8EYa59U6A5wxO4N3kiaeBe78QfItZge6C30=; b=glksZFB1akSD8GRB5c70P2ZnhY mJoTzpW2StbfDThiJLr6v23meqD2rYrFEUl3GwyZDIGEzm2AdOFHCcE/es/5xj0raz82qUHUGOCqy BWfLTCwazW1yRPWYS8ZMZZfGnsARn3/wWeOWWxLWxWKkBErrD2Y2ZquOU8DFXNVTwklUc4P82vET7 /cxDldHSRQjvDVQszuDqsLv7L4HXzzKUT3qCXNTFysn8skO0YBdHYT+QgcSGyllY63HsE3basiAhn i/3r+JOHk5cEJ2gn4jtzNSBWiGyPOV5eRaaf0H3stvd73VdPfqUkh23uf5w0UEKZau+Wi5Ye5iDhy vPt4Szvw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1iQRf1-00022F-NY; Fri, 01 Nov 2019 07:47:55 +0000 Received: from mail-wr1-x442.google.com ([2a00:1450:4864:20::442]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1iQRcj-00089u-4s for linux-arm-kernel@lists.infradead.org; Fri, 01 Nov 2019 07:45:34 +0000 Received: by mail-wr1-x442.google.com with SMTP id p4so8788237wrm.8 for ; Fri, 01 Nov 2019 00:45:32 -0700 (PDT) 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; bh=G66DJ8x191Pz9QU5XLq/zdiIBtE2uKywn/4cMYv/RBg=; b=LKOGWnyZ+ssOprnTgp43gChOt34A7AW4ibBfDtuBIW1V9+TM+2J+xFUre8GLvyPFik PvpW26uL6ZwlNoNueYi+wocJOmRhRlgnj5JXrog3pPTIQJE4FbgdALfMKZ6vCdPAXwk/ 98gUmHW7r/gDma0V9jhqm2VN4gCns7G+l/8CXDbef88Iy0GnbO0ZxAQZDQXQYE90NoEx IfJ9zoyKTTuoyZ4MfXGiv0Yg9dUflza1bwxv/0/l0aYQzomi/SV9fRKVsZNy9uFOcnnd QuUiqiESOAOif6zPTLb4/ZmMHIIM5Udx/vPKTJpIRjwE4wD/EDIZCXEXZyXxnbPbb8p0 CKew== 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; bh=G66DJ8x191Pz9QU5XLq/zdiIBtE2uKywn/4cMYv/RBg=; b=cD08l5kh6N9tqoUGD2dULYjO6rP5p5UnCc1XeV0yWoZ3kLHmkTPi1+T/dO9Poe/bl1 yxJfgrUt8tOb+on7p0Ed6aXZEIzmoxbrpV0PwnBrgEXtMX6HlR05VnOpdM22fcFzP/Y+ A9sGEZ5fTq+IC4QaXqFrj2Eu33WBFCjfpOESSntRkFFFllSvnHAoT/LE2/NLTi7579E/ 0/UQd9YWBAWmlH3FOrLCykP4DUe7pEqydJcaSJCAZK9j0rKsIlIh7ZSlyhNwyOfcoQUw 9YweRqUixDHKE5TQOyh+HVztUDdJ93p4C2xndYQrfqpCCbBSs/si5zTYNFiM0aARkMcH +SDw== X-Gm-Message-State: APjAAAVSkBtRK9tGT0kZ2//eVtIfsPv+WXt4M0N20Zgmha7V2WSjG3MT fUh7ohr9OYXuOsSMNHjEjBDt1HG7B9o= X-Google-Smtp-Source: APXvYqwzlKLx0lqdsmRFuDGhK5TYB9WOrCqeFTMPHtWdc5R3p6MbIGL6snQgGyvqo5TrPN/eU+CBgQ== X-Received: by 2002:a5d:694d:: with SMTP id r13mr8929386wrw.395.1572594331448; Fri, 01 Nov 2019 00:45:31 -0700 (PDT) Received: from localhost.localdomain ([2.31.163.64]) by smtp.gmail.com with ESMTPSA id b1sm576215wrw.77.2019.11.01.00.45.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Nov 2019 00:45:30 -0700 (PDT) From: Lee Jones To: daniel.thompson@linaro.org, broonie@kernel.org Subject: [PATCH v4 09/10] mfd: mfd-core: Remove usage counting for .{en, dis}able() call-backs Date: Fri, 1 Nov 2019 07:45:17 +0000 Message-Id: <20191101074518.26228-10-lee.jones@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191101074518.26228-1-lee.jones@linaro.org> References: <20191101074518.26228-1-lee.jones@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20191101_004533_296616_25E6EEA0 X-CRM114-Status: GOOD ( 18.41 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:442 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: baohua@kernel.org, stephan@gerhold.net, arnd@arndb.de, linus.walleij@linaro.org, linux-kernel@vger.kernel.org, Lee Jones , linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org The MFD implementation for reference counting was complex and unnecessary. There was only one bona fide user which has now been converted to handle the process in a different way. Any future resource protection, shared enablement functions should be handed by the parent device, rather than through the MFD subsystem API. Signed-off-by: Lee Jones Reviewed-by: Daniel Thompson Reviewed-by: Mark Brown --- drivers/mfd/mfd-core.c | 57 +++++++--------------------------------- include/linux/mfd/core.h | 2 -- 2 files changed, 9 insertions(+), 50 deletions(-) diff --git a/drivers/mfd/mfd-core.c b/drivers/mfd/mfd-core.c index e38e411ca775..2535dd3605c0 100644 --- a/drivers/mfd/mfd-core.c +++ b/drivers/mfd/mfd-core.c @@ -26,53 +26,31 @@ static struct device_type mfd_dev_type = { int mfd_cell_enable(struct platform_device *pdev) { const struct mfd_cell *cell = mfd_get_cell(pdev); - int err = 0; if (!cell->enable) { dev_dbg(&pdev->dev, "No .enable() call-back registered\n"); return 0; } - /* only call enable hook if the cell wasn't previously enabled */ - if (atomic_inc_return(cell->usage_count) == 1) - err = cell->enable(pdev); - - /* if the enable hook failed, decrement counter to allow retries */ - if (err) - atomic_dec(cell->usage_count); - - return err; + return cell->enable(pdev); } EXPORT_SYMBOL(mfd_cell_enable); int mfd_cell_disable(struct platform_device *pdev) { const struct mfd_cell *cell = mfd_get_cell(pdev); - int err = 0; if (!cell->disable) { dev_dbg(&pdev->dev, "No .disable() call-back registered\n"); return 0; } - /* only disable if no other clients are using it */ - if (atomic_dec_return(cell->usage_count) == 0) - err = cell->disable(pdev); - - /* if the disable hook failed, increment to allow retries */ - if (err) - atomic_inc(cell->usage_count); - - /* sanity check; did someone call disable too many times? */ - WARN_ON(atomic_read(cell->usage_count) < 0); - - return err; + return cell->disable(pdev); } EXPORT_SYMBOL(mfd_cell_disable); static int mfd_platform_add_cell(struct platform_device *pdev, - const struct mfd_cell *cell, - atomic_t *usage_count) + const struct mfd_cell *cell) { if (!cell) return 0; @@ -81,7 +59,6 @@ static int mfd_platform_add_cell(struct platform_device *pdev, if (!pdev->mfd_cell) return -ENOMEM; - pdev->mfd_cell->usage_count = usage_count; return 0; } @@ -144,7 +121,7 @@ static inline void mfd_acpi_add_device(const struct mfd_cell *cell, #endif static int mfd_add_device(struct device *parent, int id, - const struct mfd_cell *cell, atomic_t *usage_count, + const struct mfd_cell *cell, struct resource *mem_base, int irq_base, struct irq_domain *domain) { @@ -206,7 +183,7 @@ static int mfd_add_device(struct device *parent, int id, goto fail_alias; } - ret = mfd_platform_add_cell(pdev, cell, usage_count); + ret = mfd_platform_add_cell(pdev, cell); if (ret) goto fail_alias; @@ -296,16 +273,9 @@ int mfd_add_devices(struct device *parent, int id, { int i; int ret; - atomic_t *cnts; - - /* initialize reference counting for all cells */ - cnts = kcalloc(n_devs, sizeof(*cnts), GFP_KERNEL); - if (!cnts) - return -ENOMEM; for (i = 0; i < n_devs; i++) { - atomic_set(&cnts[i], 0); - ret = mfd_add_device(parent, id, cells + i, cnts + i, mem_base, + ret = mfd_add_device(parent, id, cells + i, mem_base, irq_base, domain); if (ret) goto fail; @@ -316,17 +286,15 @@ int mfd_add_devices(struct device *parent, int id, fail: if (i) mfd_remove_devices(parent); - else - kfree(cnts); + return ret; } EXPORT_SYMBOL(mfd_add_devices); -static int mfd_remove_devices_fn(struct device *dev, void *c) +static int mfd_remove_devices_fn(struct device *dev, void *data) { struct platform_device *pdev; const struct mfd_cell *cell; - atomic_t **usage_count = c; if (dev->type != &mfd_dev_type) return 0; @@ -337,20 +305,13 @@ static int mfd_remove_devices_fn(struct device *dev, void *c) regulator_bulk_unregister_supply_alias(dev, cell->parent_supplies, cell->num_parent_supplies); - /* find the base address of usage_count pointers (for freeing) */ - if (!*usage_count || (cell->usage_count < *usage_count)) - *usage_count = cell->usage_count; - platform_device_unregister(pdev); return 0; } void mfd_remove_devices(struct device *parent) { - atomic_t *cnts = NULL; - - device_for_each_child_reverse(parent, &cnts, mfd_remove_devices_fn); - kfree(cnts); + device_for_each_child_reverse(parent, NULL, mfd_remove_devices_fn); } EXPORT_SYMBOL(mfd_remove_devices); diff --git a/include/linux/mfd/core.h b/include/linux/mfd/core.h index bd8c0e089164..919f09fb07b7 100644 --- a/include/linux/mfd/core.h +++ b/include/linux/mfd/core.h @@ -30,8 +30,6 @@ struct mfd_cell { const char *name; int id; - /* refcounting for multiple drivers to use a single cell */ - atomic_t *usage_count; int (*enable)(struct platform_device *dev); int (*disable)(struct platform_device *dev); From patchwork Fri Nov 1 07:45:18 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 11222501 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C8D5B14DB for ; Fri, 1 Nov 2019 07:47:40 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A61E62080F for ; Fri, 1 Nov 2019 07:47:40 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="IJGKAIoJ"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="dnSa6iYh" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A61E62080F Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=6+goT4HjXtznIOmwmreYeG1Mwh4J4Hoj84KuJadyIt8=; b=IJGKAIoJQ4fUtSi6/ucMEez1U/ ERPDAk4ed2w0mnnrdazM+DAxrT6E/oR5/xLN2dgxDqmL/1ICRl7nrvITzmT1FczI1J7dPkMHUNo6L MlGGE6hmKP72yI/9kECa4xmqh40tIdXC73KKy+yCjE8alZWZRyv3C8xnGs0opIznA3bbfsTfIC6b6 HCEQRgRwwGWDeSG/68RroGF4/dpGY+x1UqgH2FM1Mm+Y2Hno5JPKQkmFsWSvg3+5fg96Dbg9i+tBi zNwCwTgbpfp6A7JXQiNBPJuBhRuvWu0j8EXCdUQ/KSyTK/ZCDfzbhbg9G5Oz8tCGHDzBbHXjOE4xy 7naZusaA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1iQRel-0001nC-D5; Fri, 01 Nov 2019 07:47:39 +0000 Received: from mail-wr1-x444.google.com ([2a00:1450:4864:20::444]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1iQRcj-0008B2-Pm for linux-arm-kernel@lists.infradead.org; Fri, 01 Nov 2019 07:45:35 +0000 Received: by mail-wr1-x444.google.com with SMTP id o28so8790705wro.7 for ; Fri, 01 Nov 2019 00:45:33 -0700 (PDT) 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; bh=L3ntFqp0Br65sFjkR6CV5W+v78yDN2My2Y/1a4PurZc=; b=dnSa6iYhiNbdnjJmZ64ci22Ch8sTiVytWPZwp/hjW4bZZj9bX8HlNOYpLoAJtK5QAW Mjqohe0lpiN6BwInpgNQwBaMm48MYcx6CmBAjKRAXH7Ehq5xE64nuEyjgqn6s/vuwoo3 6vTfUBcQyK5pt++HyFRgz/y4lBQg0/NNs+GOae3rK+gMX+/aEsXaOOuk5NyQs2YoEchD flDohJEiKxDyuUWk6L+KAxXWJNP/GlaHVI+5rw7gBmd8ms7/mvM0CdudoEcElp7d6Lu+ 9C0eNZNkHRPYs0IIF5MtPX0dISfIH/38IYa/Ffo67/O4qa1tko1zJQn9o7W9W4rlmvFw VKSw== 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; bh=L3ntFqp0Br65sFjkR6CV5W+v78yDN2My2Y/1a4PurZc=; b=sF/boBkgZ3Cx0fD6/rajr69xvaA/+IKGfeVY47tbxmnyKh3aHhzI3C1hCl30/m/MJP 4L37+JAE1yMjhImlX0mp9URWBGoBHOmPe9w0xDiro+B8MiZsyH0VXAjKS41y31xe58qN wbBnnox+iyoC7/PhYitJ87Sf7dCjOgFGEg7aCTsF9rUtU6Q85hK18YNZZXQr5Mdqx5ar kU1obH3k0iO3CIhsXvEZ+MaNJPffwEZjuNse9aBz/DBbqz62fmsxf1BrXXGLTXiD4Q6m QdRLKT098/qfbD0UW9EnD4LELCdqUD+6Pl+tRPahSCpOLSKIc8G++jm4Xa1HqdQItkxh tuBw== X-Gm-Message-State: APjAAAVD9i1abgB9YIZBa1WxKHoqvtfKIzKtVnBaZ1FkWb834IdUi5kx bjijDhWlr+Ns+bvV80OZnzIIF3PHGMM= X-Google-Smtp-Source: APXvYqx/1+hZC5UBRjfU3f5D4vrBgNt9VxnDiNvcvjWAc0qKrIRAMx9kJKRvXpI1bvbFhPWOGkmUqQ== X-Received: by 2002:adf:9799:: with SMTP id s25mr9477755wrb.390.1572594332397; Fri, 01 Nov 2019 00:45:32 -0700 (PDT) Received: from localhost.localdomain ([2.31.163.64]) by smtp.gmail.com with ESMTPSA id b1sm576215wrw.77.2019.11.01.00.45.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Nov 2019 00:45:31 -0700 (PDT) From: Lee Jones To: daniel.thompson@linaro.org, broonie@kernel.org Subject: [PATCH v4 10/10] mfd: mfd-core: Move pdev->mfd_cell creation back into mfd_add_device() Date: Fri, 1 Nov 2019 07:45:18 +0000 Message-Id: <20191101074518.26228-11-lee.jones@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191101074518.26228-1-lee.jones@linaro.org> References: <20191101074518.26228-1-lee.jones@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20191101_004533_923342_F85E8B15 X-CRM114-Status: GOOD ( 12.73 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:444 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: baohua@kernel.org, stephan@gerhold.net, arnd@arndb.de, linus.walleij@linaro.org, linux-kernel@vger.kernel.org, Lee Jones , linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org Most of the complexity of mfd_platform_add_cell() has been removed. The only functionality left duplicates cell memory into the child's platform device. Since it's only a few lines, moving it to the main thread and removing the superfluous function makes sense. Signed-off-by: Lee Jones Reviewed-by: Daniel Thompson Reviewed-by: Mark Brown --- drivers/mfd/mfd-core.c | 21 ++++----------------- 1 file changed, 4 insertions(+), 17 deletions(-) diff --git a/drivers/mfd/mfd-core.c b/drivers/mfd/mfd-core.c index 2535dd3605c0..cb3e0a14bbdd 100644 --- a/drivers/mfd/mfd-core.c +++ b/drivers/mfd/mfd-core.c @@ -49,19 +49,6 @@ int mfd_cell_disable(struct platform_device *pdev) } EXPORT_SYMBOL(mfd_cell_disable); -static int mfd_platform_add_cell(struct platform_device *pdev, - const struct mfd_cell *cell) -{ - if (!cell) - return 0; - - pdev->mfd_cell = kmemdup(cell, sizeof(*cell), GFP_KERNEL); - if (!pdev->mfd_cell) - return -ENOMEM; - - return 0; -} - #if IS_ENABLED(CONFIG_ACPI) static void mfd_acpi_add_device(const struct mfd_cell *cell, struct platform_device *pdev) @@ -141,6 +128,10 @@ static int mfd_add_device(struct device *parent, int id, if (!pdev) goto fail_alloc; + pdev->mfd_cell = kmemdup(cell, sizeof(*cell), GFP_KERNEL); + if (!pdev->mfd_cell) + goto fail_device; + res = kcalloc(cell->num_resources, sizeof(*res), GFP_KERNEL); if (!res) goto fail_device; @@ -183,10 +174,6 @@ static int mfd_add_device(struct device *parent, int id, goto fail_alias; } - ret = mfd_platform_add_cell(pdev, cell); - if (ret) - goto fail_alias; - for (r = 0; r < cell->num_resources; r++) { res[r].name = cell->resources[r].name; res[r].flags = cell->resources[r].flags;