All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: Russell King <rmk+kernel@armlinux.org.uk>
Cc: linux-input@vger.kernel.org
Subject: Re: [PATCH] Input: sa1111ps2 - use sa1111_get_irq() to obtain IRQ resources
Date: Tue, 26 Sep 2017 09:57:55 -0700	[thread overview]
Message-ID: <20170926165755.GF14833@dtor-ws> (raw)
In-Reply-To: <E1dwmqQ-0002nf-9M@rmk-PC.armlinux.org.uk>

On Tue, Sep 26, 2017 at 11:12:02AM +0100, Russell King wrote:
> Use the provided sa1111_get_irq() to fetch the IRQ resources for the
> SA1111 PS/2 driver.
> 
> Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>

Applied, thank you.

> ---
>  drivers/input/serio/sa1111ps2.c | 35 ++++++++++++++++++++++++-----------
>  1 file changed, 24 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/input/serio/sa1111ps2.c b/drivers/input/serio/sa1111ps2.c
> index b3e688911fd9..3b54050b9fc7 100644
> --- a/drivers/input/serio/sa1111ps2.c
> +++ b/drivers/input/serio/sa1111ps2.c
> @@ -47,6 +47,8 @@ struct ps2if {
>  	struct serio		*io;
>  	struct sa1111_dev	*dev;
>  	void __iomem		*base;
> +	int			rx_irq;
> +	int			tx_irq;
>  	unsigned int		open;
>  	spinlock_t		lock;
>  	unsigned int		head;
> @@ -126,7 +128,7 @@ static int ps2_write(struct serio *io, unsigned char val)
>  		sa1111_writel(val, ps2if->base + PS2DATA);
>  	} else {
>  		if (ps2if->head == ps2if->tail)
> -			enable_irq(ps2if->dev->irq[1]);
> +			enable_irq(ps2if->tx_irq);
>  		head = (ps2if->head + 1) & (sizeof(ps2if->buf) - 1);
>  		if (head != ps2if->tail) {
>  			ps2if->buf[ps2if->head] = val;
> @@ -147,28 +149,28 @@ static int ps2_open(struct serio *io)
>  	if (ret)
>  		return ret;
>  
> -	ret = request_irq(ps2if->dev->irq[0], ps2_rxint, 0,
> +	ret = request_irq(ps2if->rx_irq, ps2_rxint, 0,
>  			  SA1111_DRIVER_NAME(ps2if->dev), ps2if);
>  	if (ret) {
>  		printk(KERN_ERR "sa1111ps2: could not allocate IRQ%d: %d\n",
> -			ps2if->dev->irq[0], ret);
> +			ps2if->rx_irq, ret);
>  		sa1111_disable_device(ps2if->dev);
>  		return ret;
>  	}
>  
> -	ret = request_irq(ps2if->dev->irq[1], ps2_txint, 0,
> +	ret = request_irq(ps2if->tx_irq, ps2_txint, 0,
>  			  SA1111_DRIVER_NAME(ps2if->dev), ps2if);
>  	if (ret) {
>  		printk(KERN_ERR "sa1111ps2: could not allocate IRQ%d: %d\n",
> -			ps2if->dev->irq[1], ret);
> -		free_irq(ps2if->dev->irq[0], ps2if);
> +			ps2if->tx_irq, ret);
> +		free_irq(ps2if->rx_irq, ps2if);
>  		sa1111_disable_device(ps2if->dev);
>  		return ret;
>  	}
>  
>  	ps2if->open = 1;
>  
> -	enable_irq_wake(ps2if->dev->irq[0]);
> +	enable_irq_wake(ps2if->rx_irq);
>  
>  	sa1111_writel(PS2CR_ENA, ps2if->base + PS2CR);
>  	return 0;
> @@ -180,12 +182,12 @@ static void ps2_close(struct serio *io)
>  
>  	sa1111_writel(0, ps2if->base + PS2CR);
>  
> -	disable_irq_wake(ps2if->dev->irq[0]);
> +	disable_irq_wake(ps2if->rx_irq);
>  
>  	ps2if->open = 0;
>  
> -	free_irq(ps2if->dev->irq[1], ps2if);
> -	free_irq(ps2if->dev->irq[0], ps2if);
> +	free_irq(ps2if->tx_irq, ps2if);
> +	free_irq(ps2if->rx_irq, ps2if);
>  
>  	sa1111_disable_device(ps2if->dev);
>  }
> @@ -264,7 +266,6 @@ static int ps2_probe(struct sa1111_dev *dev)
>  		goto free;
>  	}
>  
> -
>  	serio->id.type		= SERIO_8042;
>  	serio->write		= ps2_write;
>  	serio->open		= ps2_open;
> @@ -279,6 +280,18 @@ static int ps2_probe(struct sa1111_dev *dev)
>  
>  	spin_lock_init(&ps2if->lock);
>  
> +	ps2if->rx_irq = sa1111_get_irq(dev, 0);
> +	if (ps2if->rx_irq <= 0) {
> +		ret = ps2if->rx_irq ? : -ENXIO;
> +		goto free;
> +	}
> +
> +	ps2if->tx_irq = sa1111_get_irq(dev, 1);
> +	if (ps2if->tx_irq <= 0) {
> +		ret = ps2if->tx_irq ? : -ENXIO;
> +		goto free;
> +	}
> +
>  	/*
>  	 * Request the physical region for this PS2 port.
>  	 */
> -- 
> 2.7.4
> 

-- 
Dmitry

      reply	other threads:[~2017-09-26 16:57 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-26 10:12 [PATCH] Input: sa1111ps2 - use sa1111_get_irq() to obtain IRQ resources Russell King
2017-09-26 16:57 ` Dmitry Torokhov [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170926165755.GF14833@dtor-ws \
    --to=dmitry.torokhov@gmail.com \
    --cc=linux-input@vger.kernel.org \
    --cc=rmk+kernel@armlinux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.