From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757334Ab3LWMjH (ORCPT ); Mon, 23 Dec 2013 07:39:07 -0500 Received: from bear.ext.ti.com ([192.94.94.41]:53295 "EHLO bear.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757302Ab3LWMjD (ORCPT ); Mon, 23 Dec 2013 07:39:03 -0500 Message-ID: <52B83C3C.6090906@ti.com> Date: Mon, 23 Dec 2013 15:35:56 +0200 From: Grygorii Strashko User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.2.0 MIME-Version: 1.0 To: Sekhar Nori , Santosh Shilimkar , Linus Walleij , Alexandre Courbot CC: Rob Herring , , , , , , Subject: Re: [PATCH v2 2/2] gpio: davinci: reuse for Keystone SoC References: <1387361272-20861-1-git-send-email-grygorii.strashko@ti.com> <1387361272-20861-3-git-send-email-grygorii.strashko@ti.com> <52B7080F.7000900@ti.com> In-Reply-To: <52B7080F.7000900@ti.com> Content-Type: text/plain; charset="ISO-8859-1"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [10.167.145.75] X-EXCLAIMER-MD-CONFIG: f9c360f5-3d1e-4c3c-8703-f45bf52eff6b Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 12/22/2013 05:41 PM, Sekhar Nori wrote: > On Wednesday 18 December 2013 03:37 PM, Grygorii Strashko wrote: >> The similar GPIO HW block is used by keystone SoCs as >> in Davinci SoCs. >> Hence, reuse Davinci GPIO driver for Keystone taking into >> account that Keystone contains ARM GIC IRQ controller which >> is implemented using IRQ Chip. >> >> Documentation: >> http://www.ti.com/lit/ug/sprugv1/sprugv1.pdf >> >> Cc: Linus Walleij >> Cc: Alexandre Courbot >> Cc: Sekhar Nori >> Cc: devicetree@vger.kernel.org >> >> Acked-by: Santosh Shilimkar >> Signed-off-by: Grygorii Strashko >> --- >> .../devicetree/bindings/gpio/gpio-davinci.txt | 4 +- >> drivers/gpio/gpio-davinci.c | 46 ++++++++++++++++---- >> 2 files changed, 40 insertions(+), 10 deletions(-) >> >> diff --git a/Documentation/devicetree/bindings/gpio/gpio-davinci.txt b/Documentation/devicetree/bindings/gpio/gpio-davinci.txt >> index a2e839d..4ce9862 100644 >> --- a/Documentation/devicetree/bindings/gpio/gpio-davinci.txt >> +++ b/Documentation/devicetree/bindings/gpio/gpio-davinci.txt >> @@ -1,7 +1,7 @@ >> -Davinci GPIO controller bindings >> +Davinci/Keystone GPIO controller bindings >> >> Required Properties: >> -- compatible: should be "ti,dm6441-gpio" >> +- compatible: should be "ti,dm6441-gpio", "ti,keystone-gpio" >> >> - reg: Physical base address of the controller and the size of memory mapped >> registers. >> diff --git a/drivers/gpio/gpio-davinci.c b/drivers/gpio/gpio-davinci.c >> index 1b33806..38741cc 100644 >> --- a/drivers/gpio/gpio-davinci.c >> +++ b/drivers/gpio/gpio-davinci.c >> @@ -413,6 +413,26 @@ static const struct irq_domain_ops davinci_gpio_irq_ops = { >> .xlate = irq_domain_xlate_onetwocell, >> }; >> >> +static struct irq_chip *davinci_gpio_get_irq_chip(unsigned int irq) >> +{ >> + static struct irq_chip_type gpio_unbanked; >> + >> + gpio_unbanked = *container_of(irq_get_chip(irq), >> + struct irq_chip_type, chip); >> + >> + return &gpio_unbanked.chip; >> +}; >> + >> +static struct irq_chip *keystone_gpio_get_irq_chip(unsigned int irq) >> +{ >> + static struct irq_chip gpio_unbanked; >> + >> + gpio_unbanked = *irq_get_chip(irq); >> + return &gpio_unbanked; >> +}; >> + >> +static const struct of_device_id davinci_gpio_ids[]; >> + >> /* >> * NOTE: for suspend/resume, probably best to make a platform_device with >> * suspend_late/resume_resume calls hooking into results of the set_wake() >> @@ -433,6 +453,18 @@ static int davinci_gpio_irq_setup(struct platform_device *pdev) >> struct davinci_gpio_platform_data *pdata = dev->platform_data; >> struct davinci_gpio_regs __iomem *g; >> struct irq_domain *irq_domain = NULL; >> + const struct of_device_id *match; >> + struct irq_chip *irq_chip; >> + struct irq_chip *(*gpio_get_irq_chip)(unsigned int irq); >> + >> + /* >> + * Use davinci_gpio_get_irq_chip by default to handle non DT cases >> + */ >> + gpio_get_irq_chip = davinci_gpio_get_irq_chip; >> + match = of_match_device(of_match_ptr(davinci_gpio_ids), >> + dev); >> + if (match) >> + gpio_get_irq_chip = match->data; > > This produces a sparse warning: > > CHECK drivers/gpio/gpio-davinci.c > drivers/gpio/gpio-davinci.c:467:35: warning: incorrect type in assignment (different modifiers) > drivers/gpio/gpio-davinci.c:467:35: expected struct irq_chip *( *[assigned] gpio_get_irq_chip )( ... ) > drivers/gpio/gpio-davinci.c:467:35: got void const *const data > I'll fix it, thanks.