From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S937345AbdAKLEy (ORCPT ); Wed, 11 Jan 2017 06:04:54 -0500 Received: from mail-qt0-f175.google.com ([209.85.216.175]:33009 "EHLO mail-qt0-f175.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932802AbdAKLEw (ORCPT ); Wed, 11 Jan 2017 06:04:52 -0500 MIME-Version: 1.0 In-Reply-To: <1483518389-6200-2-git-send-email-j-keerthy@ti.com> References: <1483518389-6200-1-git-send-email-j-keerthy@ti.com> <1483518389-6200-2-git-send-email-j-keerthy@ti.com> From: Linus Walleij Date: Wed, 11 Jan 2017 12:04:51 +0100 Message-ID: Subject: Re: [PATCH 2/2] gpio: davinci: Remove gpio2regs function to accommodate multi instances To: Keerthy Cc: "linux-kernel@vger.kernel.org" , "linux-gpio@vger.kernel.org" , Alexandre Courbot , Tero Kristo Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jan 4, 2017 at 9:26 AM, Keerthy wrote: > gpio2regs is written making an assumption that driver supports only > one instance of gpio controller. Removing this and adding a generic > array so as to support multiple instances of gpio controllers. > > Signed-off-by: Keerthy > - regs = gpio2regs(base); > + regs = gpio_base + offset_array[i]; I understand this. > - struct davinci_gpio_regs __iomem *g = gpio2regs(hw); > + struct davinci_gpio_controller *chips = > + (struct davinci_gpio_controller *)d->host_data; > + struct davinci_gpio_regs __iomem *g = chips[hw / 32].regs; And this, if each instans has 32 GPIOs. > - g = gpio2regs(0); > + g = chips[0].regs; Also makes sense. > - g = gpio2regs(gpio); > + g = chips[bank / 2].regs; But what is this? I don't understand that /2 at all. Please insert a comment explaining it so I can figure it out. Are there two banks per instance? Yours, Linus Walleij