Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp1754486ybg; Sat, 19 Oct 2019 01:48:35 -0700 (PDT) X-Google-Smtp-Source: APXvYqyNCZ7PzhFV1OImz8PLsU6PKEuOCt9tcpQaZp/vhuGa/M4VtiLHfXUWXu9mVRvL/Vb9lLnr X-Received: by 2002:a17:906:3615:: with SMTP id q21mr12312903ejb.152.1571474914844; Sat, 19 Oct 2019 01:48:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571474914; cv=none; d=google.com; s=arc-20160816; b=EKSQhmrezwoXhuLZPjTQSe47kerOf2GNKybnSb27Ltp/JBn/fzKm2r2IZc2SJMwRjw G0BiqjcNqqs4ZW+5rbPCG8uLjKN7J6OhIOwKBIlOLzSXFqfgSv0mbu24Qjw0ouwkGO7V Tz5hn5e6UyJm38rjlxTgVIEBlIviigUYs2x+IweS23LjM7MkggU8bx4Pp9nhbPi1nzBL qF9o50vMNo1pY+UkSGZ/pQ9KfGqHh+c7aYTXea+YfN80UBajJwCyQS6B2KkVW66w4Pyw eMV5tCMfjf2URpHFHndifluwELZ9xY0JRxC7+j5keHbWM8TcQvs6Borlso1aZ1f9Qk2n rdVA== 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=LS0jfvIIecs+OvBAsmjsVuR4UJ3S5OKog133XvRo+zI=; b=rjb4Uqd6O66JU6x4XCSsJ7SPYKCkdRwdSafBw42Z9pBuYCzXkiw6hqwVLgKK07VANo iOuGi/4L3s7iJd3Io4Bfu3BWynkyQtaYunSV4uqCx7Nc8wF+KU0eU8wLk1NlpijEXCYO VBDFJkFPOUO6tzQkJRPhFXYLNA1DMOLlqZNLbwJ3KJcLhh7bNV93fwNm3mm4465mCovG Ru0xfeCgtbiO3XdrwHKCKmwI0D7iZ6HAT1o8pSIsmmcpIZNP0sXdbWcEDGaU9GG5yDbd eKbD8rdEbEtoJsCkdfXm2TxcyBb1l+29homEH3Z7Wu0HzVEsF8B0/ydynBk6AiI7ie9F bTpA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=G3ODp2LY; 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 k1si4786243eja.146.2019.10.19.01.48.11; Sat, 19 Oct 2019 01:48: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=G3ODp2LY; 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 S2409300AbfJRQyf (ORCPT + 99 others); Fri, 18 Oct 2019 12:54:35 -0400 Received: from mail-wr1-f65.google.com ([209.85.221.65]:33972 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2409276AbfJRQyf (ORCPT ); Fri, 18 Oct 2019 12:54:35 -0400 Received: by mail-wr1-f65.google.com with SMTP id t16so1866299wrr.1 for ; Fri, 18 Oct 2019 09:54:33 -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=LS0jfvIIecs+OvBAsmjsVuR4UJ3S5OKog133XvRo+zI=; b=G3ODp2LYYhc7I9PzVDJ1ElXhV/36MfDO5Zo+vFWbkekAoLjlWkEoBffhS1py5i3bS2 jAQtktHkDGE1f1XfFkeEXYYvsQoB4ESDm8sIs/CERJdxv+3OwYAAJRgmKnsPeIEJ1ygB SFY96EOTdAs5J/F8BWWGtlAGW0TJ+2eIxcgUI6Epe4ECaeqI2fsxfRqI7gJ5jEKoUY8k zWVzSBLaKivNJjdM7Wx9nfJjmP7vy9ZGYobrHtRh1UUOUZHzstZpT3xkkeRVA5zciy+I 7Y22kqvci3fiWIDEspwZezDEVqouts6IsWsQoRRP0SGO6kK4Y4r4QEs64g65gedgA4th B5PQ== 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=LS0jfvIIecs+OvBAsmjsVuR4UJ3S5OKog133XvRo+zI=; b=eQxHNsvQifCYct4YyE2Cqu8RnqacqdPm2aI3uR2gjBsZoXL0M9dTCztIo4vimHqp0x cmGb4/wks/y0EI8xD2ob5cmv5kgoV8D25wSzSKBCFdgB0qdZbjBIhubITrRBMVyhKLI8 H1IFU9tkn8cJwjWsxop1xSsKWxaJl6HukfGx1+NUnJ1nvdnvagV0vpsdam4Dq1Cf/ALl ji/zLAJb0HeKH/eEPEGCUXlaUfA4+mygcSbP1996qrAwuTWebMla5gYQMEU251RTxRWT FgtUH4pSi6t2skFTwpiSRX12IawPpzJlbhMYqb+HiWP+mYa2UGjAhbh3l4aQp7/wRXek UagQ== X-Gm-Message-State: APjAAAWZXFhfBe9x3cUKiTC6NqqfPNSWOoenM4uWARSfYomZnhH/yJBe GgEF8dFrIWwoK1tZCrvZyG/46Q== X-Received: by 2002:adf:d08d:: with SMTP id y13mr8293096wrh.138.1571417672706; Fri, 18 Oct 2019 09:54:32 -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 c4sm6007302wru.31.2019.10.18.09.54.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Oct 2019 09:54:31 -0700 (PDT) Date: Fri, 18 Oct 2019 17:54:30 +0100 From: Daniel Thompson To: Lee Jones Cc: broonie@kernel.org, linus.walleij@linaro.org, arnd@arndb.de, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, dilinger@queued.net Subject: Re: [PATCH 2/4] mfd: cs5535-mfd: Remove mfd_cell->id hack Message-ID: <20191018165430.abyhbdodrjurx6g7@holly.lan> References: <20191018125608.5362-1-lee.jones@linaro.org> <20191018125608.5362-3-lee.jones@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20191018125608.5362-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 Fri, Oct 18, 2019 at 01:56:06PM +0100, Lee Jones wrote: > The current implementation abuses the platform 'id' mfd_cell member > to index into the correct resources entry. If we place all cells > into their numbered slots, we can cycle through all the cell entries > and only process the populated ones which avoids this behaviour. > > Signed-off-by: Lee Jones > --- > drivers/mfd/cs5535-mfd.c | 31 +++++++++++++------------------ > 1 file changed, 13 insertions(+), 18 deletions(-) > > diff --git a/drivers/mfd/cs5535-mfd.c b/drivers/mfd/cs5535-mfd.c > index 2c47afc22d24..b01e5bb4ed03 100644 > --- a/drivers/mfd/cs5535-mfd.c > +++ b/drivers/mfd/cs5535-mfd.c > @@ -115,16 +110,16 @@ static int cs5535_mfd_probe(struct pci_dev *pdev, > 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; > - struct resource *r = &cs5535_mfd_resources[bar]; > + for (i = 0; i < NR_BARS; i++) { > + struct mfd_cell *cell = &cs5535_mfd_cells[i]; > + struct resource *r = &cs5535_mfd_resources[i]; > > - r->flags = IORESOURCE_IO; > - r->start = pci_resource_start(pdev, bar); > - r->end = pci_resource_end(pdev, bar); > + if (!cell) > + continue; cell will never be null. Should this be cell->num_resources instead? Daniel.