Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp4043739ybg; Fri, 25 Oct 2019 12:30:34 -0700 (PDT) X-Google-Smtp-Source: APXvYqzFII2wHZoSYvAFds3RUpYl9Frp+H5Tn4brSPXmO5HjNgsPkoT8+9aKQ5Ngq8a4n6q04ff1 X-Received: by 2002:a17:906:4813:: with SMTP id w19mr5154592ejq.258.1572031834664; Fri, 25 Oct 2019 12:30:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1572031834; cv=none; d=google.com; s=arc-20160816; b=ySdxg19CldZEA57hAplDfsZ2ljqoApP98JpGIcgTgAeljCR6z+J+GTG7YLjZVshzG6 8GbbaufKRBswWBpa3Dka1A04t5umwOMbpIaBrg64S6o7ZHzB6x4N7jTgklkA1Ibc11Jb 77TYxpQku36e+oJQ7qLclYiZoytq0LDixuAMnmr3zRshDqPNQicmptXze9cxCfldgJmE LMXHsU/z4Jw9MKV9rcirLkHVu094NsOHMQuqYhxD3qVVXagiawv3RokgFQW0whepdatS 7tmz00oOlDqnc1QKxIOtYsx9/n6ZefvVZuZJ/kFRu4CyFlV9cZNXhWbiTlaLsBy14D+z K8fQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=zH6fhJDQ4DcI0IvbaRP4GYERWR/GM64+6SCBGVBvvnM=; b=iblqY6sy2FE9a3ReIBhhZDkxS7ZG2DH96e2qD4nSeT3BM+OI4lOJG9KihNuP/+dNlG ZwbA4MniKiyyXlx5SSr7VIYT77rYvOZgZ90Kk/nAD/6RlxwGHlAx2K7hDn5K9FFfpUn8 GZvBWLprSmMu3iDe9cHISobwh7DKQVc2Dsry9XsG9JsQsl1TXNQV/khlOphUTm4VMdLz jTIWJxr9nyI5VtGafO0YomVvs4B2l2Gn1/VJwNYrhzoxM6W63s6zESYEefwWwhLiaeZI syNj4GoqYSmEdLYr+CfA11dvli/bwlnvTel8xgIP+l6FF3tER0iFjjINBkTbTM6BUYcY LVVA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="D/Z1dluM"; 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 x26si2011481edd.287.2019.10.25.12.30.11; Fri, 25 Oct 2019 12:30:34 -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="D/Z1dluM"; 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 S2406730AbfJYIg0 (ORCPT + 99 others); Fri, 25 Oct 2019 04:36:26 -0400 Received: from mail-wm1-f65.google.com ([209.85.128.65]:38181 "EHLO mail-wm1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2404179AbfJYIgZ (ORCPT ); Fri, 25 Oct 2019 04:36:25 -0400 Received: by mail-wm1-f65.google.com with SMTP id 22so971043wms.3 for ; Fri, 25 Oct 2019 01:36:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=zH6fhJDQ4DcI0IvbaRP4GYERWR/GM64+6SCBGVBvvnM=; b=D/Z1dluMcIPn/WkbjBQ4ikinQ/eFoxTiylcePish3K0XRbliy8YkkjHzKai4oKWzsZ SEtsn+i0PmLwvXF6A8jd75FOGxIsd+mTEmFQ/SPIq7n/QRYA0UF77a7mcvSpxBFQg50L Zbbu4zZzULyWMikqJ2QTYTQ95pN6NWzNosoMX0e9lQplGoYT6+D5iYp4vWzgNPfiyGf6 tMMuMLDC8+qA/ckJB7AlUvASVtvQsHKXDEX/hBia12sMhwKLLnN0vaaOob67en8sRq9X NyPBHVmPuseLG7bFTy4dfZKatYU1cITII7F1Acl+SUfyh9Xi/vEhbHEJLIf/tEKAylVp TY3g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=zH6fhJDQ4DcI0IvbaRP4GYERWR/GM64+6SCBGVBvvnM=; b=j648FqPMGg/BcS6CDIDy2JJf0hp/hhesyUBrvArZHlwqwp3raf/HtG3YqXsa/LnJLK WO1k+ofaJ0z/6fy20RLuAoQUc+XqsP0D8mX1FddFeruyNYQ96klEuxAzotqXSu1a6wrj 2FJvFajarFxe3xOM617un+gDKudhZ/eBVr/KIS4GCXiBtOBer3sCvqo01hsdngoFnoNV OiYKB1SS7ukWrOkI+w3BdDrZgLl/WjYdZgxwwUsDBBU7ySmDyaC7iDjgk9057S7VF8Np R0YftvFiYFM+RIrwpmjUxzshocgTEmXGs0B1HJz5DkFCaLfKdC5vcILYRpLt0ieYfHJi ml6A== X-Gm-Message-State: APjAAAXMhQFEQxORKfahBYjx6es/7fw8Qgwu/piDQAKZ0Sn9U/J/vEoC FzEcSkcNUqbYcaosAVD8YdXLZw== X-Received: by 2002:a1c:9cc6:: with SMTP id f189mr2230590wme.144.1571992583821; Fri, 25 Oct 2019 01:36:23 -0700 (PDT) Received: from holly.lan (cpc141214-aztw34-2-0-cust773.18-1.cable.virginm.net. [86.9.19.6]) by smtp.gmail.com with ESMTPSA id u1sm1215506wmc.38.2019.10.25.01.36.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Oct 2019 01:36:23 -0700 (PDT) Date: Fri, 25 Oct 2019 09:36:21 +0100 From: Daniel Thompson To: Lee Jones Cc: arnd@arndb.de, broonie@kernel.org, linus.walleij@linaro.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, baohua@kernel.org, stephan@gerhold.net Subject: Re: [PATCH v3 02/10] mfd: cs5535-mfd: Remove mfd_cell->id hack Message-ID: <20191025083621.rwa3wug67vwapdhw@holly.lan> References: <20191024163832.31326-1-lee.jones@linaro.org> <20191024163832.31326-3-lee.jones@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20191024163832.31326-3-lee.jones@linaro.org> User-Agent: NeoMutt/20180716 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Oct 24, 2019 at 05:38:24PM +0100, Lee Jones wrote: > 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, > -- > 2.17.1 >