From mboxrd@z Thu Jan 1 00:00:00 1970 From: u.kleine-koenig@pengutronix.de (Uwe =?iso-8859-1?Q?Kleine-K=F6nig?=) Date: Mon, 17 Nov 2014 10:59:09 +0100 Subject: [PATCH] gpio: mxs: implement get_direction callback In-Reply-To: References: <1416004026-9667-1-git-send-email-j.uzycki@elproma.com.pl> <20141114232601.GW27002@pengutronix.de> <5467A980.5090204@elproma.com.pl> <20141116214239.GX27002@pengutronix.de> <54693A51.5080907@elproma.com.pl> <54695654.3070209@elproma.com.pl> <20141117082848.GZ27002@pengutronix.de> <5469BBBD.30003@elproma.com.pl> Message-ID: <20141117095909.GH27002@pengutronix.de> To: linux-arm-kernel@lists.infradead.org List-Id: linux-arm-kernel.lists.infradead.org Hello Richard, > >>>> So finally the prototypes would be: > >>>> int mctrl_gpio_request_irqs(struct mctrl_gpios*, struct > >>>> uart_port*, irqhandler_t); > >>>> void mctrl_gpio_free_irqs(struct mctrl_gpios*); > >> > >> I think: > >> > >> struct mctrl_gpios { > >> struct uart_port *port; > >> struct { > >> gpio_desc *gpio; > >> unsigned int irq; > I think it's just "int irq;" there irqs are unsigned. Some functions returning an irq use "int", but depending on who you ask this only for error reporting or a relict. Use 0 for invalid/unused in mctrl_gpio*. > > Yes. I tried to assign irq value in mctrl_gpio_init() only. > > There was another issue if CONFIG_GPIOLIB is not defined but it looks mctrl_ > > disable/enable_ms() > > and mctrl_ irq handler solve the problem. > > > >> Not sure there is a corresponding request_irq variant for that. > > > > > > What would you propose? > In atmel_request_gpio_irq(), the function irq_set_status_flags(irq, > IRQ_NOAUTOEN); is used before request_irq to prevent the irq from > being enabled when requested. I'm not sure this is allowed. How do you handle request_irq failing? (I just checked: you don't.) Consider another thread just doing request_irq($yourirq, ...) between irq_set_status_flags(irq[i], IRQ_NOAUTOEN); and err = request_irq(irq[i], ... . Best regards Uwe -- Pengutronix e.K. | Uwe Kleine-K?nig | Industrial Linux Solutions | http://www.pengutronix.de/ |