Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp3655241ybg; Fri, 25 Oct 2019 07:10:26 -0700 (PDT) X-Google-Smtp-Source: APXvYqweCXW3V1vDWzllnmgRC9vvuBh4lVVH1f9qIlfxlhMxc7W7/fL8RBvNfO6TndRm9axsxS/D X-Received: by 2002:a17:906:5292:: with SMTP id c18mr3652175ejm.129.1572012626075; Fri, 25 Oct 2019 07:10:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1572012626; cv=none; d=google.com; s=arc-20160816; b=LPdpzDZSzPKN+wbUBzaBmGGGDScdOCHD1Ink39zQ2Hsd1L+anv5zF1kdOle0nCN4gi 1IlociW4bhVML7E0UYHku8m0+HSvEmfAjo3F7sfnnHZX3TXIR40AkZHEvu35plSN9Vy1 HCrGUw43Rw4xq8gWlN2pnupMFqUyUEcjD6/mYycr+M+0Tst+zs2s1D1o1xbX8p2DmNj+ 6LwVhhetBSgH0iiM0a/2OKmvQfaQIWRrCp61p0SG2Lvu2kipk0muDh2/5T7c2nym5ucS DQbiUn7dyDce83rnzGiNENi5ch12hQekupA9rtHfORwTJsBSSy1A0nZT9qLU5OvkrHEp F1Uw== 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=UL330JCxNCb1QfPA7XEdnee8d8sanDm58UEp+DpPD5E=; b=Qabyf71rQOZpJmvWGkfnlQOspxYWuKf+rMtH6shxsEKtHnLMBLkXBNt9+sjl1uiHfQ w+Q4oRcJcJRFeOS4BBl+OrDAbW30iaFGRFM9R+0L+NolwQ4tA/7gFBoeBPgClmIJak9p UzQ1KTtsdFSF/nu/ajwSI9BXPaXIoSnoKeQwlG1Mqo/OlPFDRGjplF8BVbYvHdwVAfCc wpe2D8w5akKvCKghqRJRjIb8MNJzUXBswbb787J4EFmFx0cxavLYini3bd/XYY4r8Kb2 YTVfNx5eZU9hIrsWB3NT0KitnC/mMWawoiXQXcdpYMn0VivSkXpuKS/5/rITUs+SwYn1 vtiA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=AO2viM8R; 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 u16si1240620edi.310.2019.10.25.07.10.00; Fri, 25 Oct 2019 07:10:26 -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=AO2viM8R; 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 S2503692AbfJXQje (ORCPT + 99 others); Thu, 24 Oct 2019 12:39:34 -0400 Received: from mail-wr1-f65.google.com ([209.85.221.65]:34270 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2503504AbfJXQil (ORCPT ); Thu, 24 Oct 2019 12:38:41 -0400 Received: by mail-wr1-f65.google.com with SMTP id t16so21708960wrr.1 for ; Thu, 24 Oct 2019 09:38:39 -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=UL330JCxNCb1QfPA7XEdnee8d8sanDm58UEp+DpPD5E=; b=AO2viM8RfA1DxiniDHFsPnX7EJHu7id0/Nbauz4pHVAcEh/Vqn3h1cCsIRCAaGNIJr ZjlMabMeGfI++dacJ1ty4Ouq/jr7hOu1XAeoUkC1u+G903TpW9UwEjkRM1uCUUrcLVxI H/H643bgLQqGEWNJw5wEUgSR2bEqy2cfVXnngqm+AfFt0J2WpsMNXHexR2K3WYED4KND 5mSLuNIQ72aRBZgvd7e+0KcCpu5+ZxUSH+089gVL4hDpasT4MWDHRnUdhJFbpRUu6rim ZFOwtDQ0W393tuxnG/lfjtS+iV+0GJXV74Y3KSZgyVIRWQsZLwLeBhH/kvS3Dlr7XQ3g bKEA== 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=UL330JCxNCb1QfPA7XEdnee8d8sanDm58UEp+DpPD5E=; b=iFJHcPB1mFZe+tZNgQhDpnTfcDVPoamkbqL4OaUWphLpcT2HbqLtyUc0753//vD8rD w2jytXwdCw+x9zz2qUExJaofl8VfoOetQ4TRHLOG4Z+qxTHoARr9VlAhzH2GrsjjK9M1 hFPvqp08epsqtphHVl0mLqMvI5ZweuZ/ZLdWqeEydaqbW4nbnmBcAzTq777tSU8JAeFK FqGXmQporkrn4VCq+Vk4KgBUECXoE5Q1vgl9vT/INDPVprSxjmGepSU2zOgvPCr5q0Yx 9d/WNluXUO0crIQ0J0hruAU//cnYWr/8bnt6DVc5ohWth1uEjckoo8uadKpeiCT8X6YL uwaA== X-Gm-Message-State: APjAAAW6n8A4M7iTGbd7DjTKaeHbinbGzgesgYdILzMmSzY0XximMviu LNDIfuQoOYXrjBzutjZHpb05LA== X-Received: by 2002:adf:da42:: with SMTP id r2mr4493849wrl.383.1571935118290; Thu, 24 Oct 2019 09:38:38 -0700 (PDT) Received: from localhost.localdomain ([95.149.164.99]) by smtp.gmail.com with ESMTPSA id 6sm3446175wmd.36.2019.10.24.09.38.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 24 Oct 2019 09:38:37 -0700 (PDT) From: Lee Jones To: daniel.thompson@linaro.org, arnd@arndb.de, broonie@kernel.org, linus.walleij@linaro.org Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, baohua@kernel.org, stephan@gerhold.net, Lee Jones Subject: [PATCH v3 02/10] mfd: cs5535-mfd: Remove mfd_cell->id hack Date: Thu, 24 Oct 2019 17:38:24 +0100 Message-Id: <20191024163832.31326-3-lee.jones@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191024163832.31326-1-lee.jones@linaro.org> References: <20191024163832.31326-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 --- 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, -- 2.17.1