linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Russell King - ARM Linux <linux@arm.linux.org.uk>
To: Zhaoyang Huang <zhaoyang.huang@linaro.org>
Cc: linux-pm@vger.kernel.org, gregkh@linuxfoundation.org,
	jslaby@suse.com, linux-serial@vger.kernel.org,
	linux-kernel@vger.kernel.org, amit.kucheria@linaro.org,
	sudeep.holla@arm.com, daniel.lezcano@linaro.org
Subject: Re: [PATCH] modify pl011 driver to let it work as wakeup source
Date: Thu, 17 Sep 2015 11:31:26 +0100	[thread overview]
Message-ID: <20150917103126.GM21084@n2100.arm.linux.org.uk> (raw)
In-Reply-To: <1442478716-7377-1-git-send-email-zhaoyang.huang@linaro.org>

On Thu, Sep 17, 2015 at 04:31:56PM +0800, Zhaoyang Huang wrote:
> +struct uart_match {
> +	struct uart_port *port;
> +	struct uart_driver *driver;
> +};
> +
> +static int match_uart_port(struct device *dev, void *data)
> +{
> +	struct uart_match *match = data;
> +
> +	dev_t devt = MKDEV(match->driver->major, match->driver->minor) +
> +		match->port->line;
> +
> +	pr_info("the match data of ttyAMA0 is %d %d\n",
> +			(int)devt, (int)dev->devt);
> +
> +	return dev->devt == devt; /* Actually, only one tty per port */
> +}
...
> +	ret = pl011_register_port(uap);
> +
> +	if (!of_find_property(dev->dev.of_node, "linux,wakeup", NULL)) {
> +		uart_dev = NULL;
> +		return ret;
> +	}
> +
> +	match.port = &uap->port;
> +	match.driver = &amba_reg;
> +
> +	uart_dev = device_find_child(&dev->dev, &match, match_uart_port);
> +
> +	if (uart_dev) {
> +		device_init_wakeup(uart_dev, true);
> +		dev_pm_set_wake_irq(uart_dev, uap->port.irq);
> +	}
> +
> +	return ret;

I can only describe this code as a hack.  This looks like something
which should be handled by generic infrastructure at an appropriate
point (somewhere inside uart_add_one_port()), not by hacky code in
each driver.

-- 
FTTC broadband for 0.8mile line: currently at 9.6Mbps down 400kbps up
according to speedtest.net.

  reply	other threads:[~2015-09-17 10:31 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-17  8:31 [PATCH] modify pl011 driver to let it work as wakeup source Zhaoyang Huang
2015-09-17 10:31 ` Russell King - ARM Linux [this message]
2015-09-17 10:39 ` Sudeep Holla
     [not found]   ` <CAN2waFt+OsiBP_TJ7cw0RAkaNgT5nWRPppe74mfr6A6oSuXdBA@mail.gmail.com>
2015-09-17 11:29     ` Sudeep Holla

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=20150917103126.GM21084@n2100.arm.linux.org.uk \
    --to=linux@arm.linux.org.uk \
    --cc=amit.kucheria@linaro.org \
    --cc=daniel.lezcano@linaro.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=jslaby@suse.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=sudeep.holla@arm.com \
    --cc=zhaoyang.huang@linaro.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).