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: 178259 Delivered-To: patch@linaro.org Received: by 2002:a92:409a:0:0:0:0:0 with SMTP id d26csp117154ill; Fri, 1 Nov 2019 00:46:00 -0700 (PDT) X-Google-Smtp-Source: APXvYqy0xQM/Dhr/j2Ht1YxG4qQNfun6eujnO13yFO3+/C8ul+KRo8sUBqEUSESOPvDrKt4qTQhp X-Received: by 2002:aa7:cb09:: with SMTP id s9mr9017948edt.148.1572594360096; Fri, 01 Nov 2019 00:46:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1572594360; cv=none; d=google.com; s=arc-20160816; b=hqcp6aamasdignKQKp+y9W2E9695XzGey/dn8DgrxVbirqiO3UbA8mymu9I56nZ2VZ I0t2Nk3xSEhlXnjoMapR9AI9jbVubk6nxnu/mTo4iO9klL9XsO/+o+3ZsOQlqlMBDt7B oJe1msXMqTpWH8xDMGHmGA+fu8xCreTBd95ClCOyRRZguKKxO0EvgE8V8RTITgBgX2WL 73j3cqpN2hcvoFG4boNDtifuua6nS0aH9H3hXHB67TU81tITYkS5ekWqGpqrkGD6Rgy0 wpGzcp+Ak4G2lz2ouCknL0wZ09BhcqbNTSmlqIqFNxf+SMKd7Vn5/i0YUyippfW+NHd0 uT/Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=C/fpce4zj8Symqro3B0UUT4uQWdn48veRLNE2xUiEm4=; b=QYKsBq6D2g2ahflA9pfQtVPDGvefQXKMEo/4BryRh2w921B2E8PYKCYq0F/y5NpAW8 Dahs3qI3sVS66jyh8Y5PCS9HGl6NcV7g7GJbDUerJlAz/4Tw/hsk1zzhRHknXA/YttAn Qmtnkwnosobq8nbuinEZS26R5Zvv1qzFQ7pLPnd7GuCKyNZh1L52H2JURUvNM5Zw4nuC hdv54bFrNFYy/Azcq6br0CVGatokzQTPrOigy3SvecIfCqqxZJY2pHsn1p17J8Vj1ybB rrRd0QnflEhBUJEqAuiugxhekgbGpEdWIZskuBYJ0b2IRx5TdBflNu244Oq2HW/vNOPT qIOg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=vdGFsAjy; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-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. [209.132.180.67]) by mx.google.com with ESMTP id v10si6363904edc.62.2019.11.01.00.45.59; Fri, 01 Nov 2019 00:46:00 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=vdGFsAjy; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-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 S1730205AbfKAHp4 (ORCPT + 26 others); Fri, 1 Nov 2019 03:45:56 -0400 Received: from mail-wr1-f66.google.com ([209.85.221.66]:33753 "EHLO mail-wr1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730082AbfKAHp0 (ORCPT ); Fri, 1 Nov 2019 03:45:26 -0400 Received: by mail-wr1-f66.google.com with SMTP id s1so8831462wro.0 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=tEqAjAgBaBbk0tobWG99PL/8myN/FXj5fSffHguRZ8cIxwaAII9ZN0DlFyCql4DXbS glv8AIGFwbOvOAxNKK2vmxslWHQXxGbD1ZNaynwtioD1In5xPoYlEXa1KjJks2PjVM73 r7pd6Llk60OSSA20GKuOPhz3CymszgHkGkWQ4sG9IHB1CbfbJjiqPSuMzUMtHjweX0f3 vTJ0KMkiy55Gn0eFRxPWw6r5zLFH0XAxvxn0+hw2XySA7EVZDbY23aGJuDtU97Qc/CG+ g6VMk/E4R4hWp8vAHnvNRZUB4seaZiILnbKLfoD8dYIdeWGS4qdQA2jLOOGIVNmE3Dqh dYgQ== X-Gm-Message-State: APjAAAV/++AaH3gx8RCP2qF0lXi6WSd2UPFX/6NWMB1ORC9a2QVyb5ZI D3j5kTz6Ak2WFtDwpp8g6p101w== 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 Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, arnd@arndb.de, linus.walleij@linaro.org, baohua@kernel.org, stephan@gerhold.net, Lee Jones 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> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.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(-) -- 2.17.1 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,