All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Kefeng Wang <wangkefeng.wang@huawei.com>,
	gregkh@linuxfoundation.org, jslaby@suse.com,
	linux-serial@vger.kernel.org
Cc: linux-acpi@vger.kernel.org, guohanjun@huawei.com,
	z.liuxinliang@hisilicon.com, xuwei5@hisilicon.com,
	graeme.gregory@linaro.org
Subject: Re: [PATCH v3 2/3] serial: 8250_dw: Use new dev variable in probe
Date: Mon, 22 Aug 2016 14:13:01 +0300	[thread overview]
Message-ID: <1471864381.4887.202.camel@linux.intel.com> (raw)
In-Reply-To: <1468580485-28567-3-git-send-email-wangkefeng.wang@huawei.com>

On Fri, 2016-07-15 at 19:01 +0800, Kefeng Wang wrote:
> Use new dev variable instead of pdev->dev and p->dev in probe
> function.

I'm not sure we need this one. What is wrong with &pdev->dev?

> 
> Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
> ---
>  drivers/tty/serial/8250/8250_dw.c | 45 ++++++++++++++++++++--------
> -----------
>  1 file changed, 23 insertions(+), 22 deletions(-)
> 
> diff --git a/drivers/tty/serial/8250/8250_dw.c
> b/drivers/tty/serial/8250/8250_dw.c
> index 65f3da7..d6934310 100644
> --- a/drivers/tty/serial/8250/8250_dw.c
> +++ b/drivers/tty/serial/8250/8250_dw.c
> @@ -358,18 +358,19 @@ static int dw8250_probe(struct platform_device
> *pdev)
>  	struct resource *regs = platform_get_resource(pdev,
> IORESOURCE_MEM, 0);
>  	int irq = platform_get_irq(pdev, 0);
>  	struct uart_port *p = &uart.port;
> +	struct device *dev = &pdev->dev;
>  	struct dw8250_data *data;
>  	int err;
>  	u32 val;
>  
>  	if (!regs) {
> -		dev_err(&pdev->dev, "no registers defined\n");
> +		dev_err(dev, "no registers defined\n");
>  		return -EINVAL;
>  	}
>  
>  	if (irq < 0) {
>  		if (irq != -EPROBE_DEFER)
> -			dev_err(&pdev->dev, "cannot get irq\n");
> +			dev_err(dev, "cannot get irq\n");
>  		return irq;
>  	}
>  
> @@ -380,17 +381,17 @@ static int dw8250_probe(struct platform_device
> *pdev)
>  	p->pm		= dw8250_do_pm;
>  	p->type		= PORT_8250;
>  	p->flags	= UPF_SHARE_IRQ | UPF_FIXED_PORT;
> -	p->dev		= &pdev->dev;
> +	p->dev		= dev;
>  	p->iotype	= UPIO_MEM;
>  	p->serial_in	= dw8250_serial_in;
>  	p->serial_out	= dw8250_serial_out;
>  	p->set_termios	= dw8250_set_termios;
>  
> -	p->membase = devm_ioremap(&pdev->dev, regs->start,
> resource_size(regs));
> +	p->membase = devm_ioremap(dev, regs->start,
> resource_size(regs));
>  	if (!p->membase)
>  		return -ENOMEM;
>  
> -	data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL);
> +	data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL);
>  	if (!data)
>  		return -ENOMEM;
>  
> @@ -398,57 +399,57 @@ static int dw8250_probe(struct platform_device
> *pdev)
>  	data->usr_reg = DW_UART_USR;
>  	p->private_data = data;
>  
> -	data->uart_16550_compatible = device_property_read_bool(p-
> >dev,
> +	data->uart_16550_compatible = device_property_read_bool(dev,
>  						"snps,uart-16550-
> compatible");
>  
> -	err = device_property_read_u32(p->dev, "reg-shift", &val);
> +	err = device_property_read_u32(dev, "reg-shift", &val);
>  	if (!err)
>  		p->regshift = val;
>  
> -	err = device_property_read_u32(p->dev, "reg-io-width", &val);
> +	err = device_property_read_u32(dev, "reg-io-width", &val);
>  	if (!err && val == 4) {
>  		p->iotype = UPIO_MEM32;
>  		p->serial_in = dw8250_serial_in32;
>  		p->serial_out = dw8250_serial_out32;
>  	}
>  
> -	if (device_property_read_bool(p->dev, "dcd-override")) {
> +	if (device_property_read_bool(dev, "dcd-override")) {
>  		/* Always report DCD as active */
>  		data->msr_mask_on |= UART_MSR_DCD;
>  		data->msr_mask_off |= UART_MSR_DDCD;
>  	}
>  
> -	if (device_property_read_bool(p->dev, "dsr-override")) {
> +	if (device_property_read_bool(dev, "dsr-override")) {
>  		/* Always report DSR as active */
>  		data->msr_mask_on |= UART_MSR_DSR;
>  		data->msr_mask_off |= UART_MSR_DDSR;
>  	}
>  
> -	if (device_property_read_bool(p->dev, "cts-override")) {
> +	if (device_property_read_bool(dev, "cts-override")) {
>  		/* Always report CTS as active */
>  		data->msr_mask_on |= UART_MSR_CTS;
>  		data->msr_mask_off |= UART_MSR_DCTS;
>  	}
>  
> -	if (device_property_read_bool(p->dev, "ri-override")) {
> +	if (device_property_read_bool(dev, "ri-override")) {
>  		/* Always report Ring indicator as inactive */
>  		data->msr_mask_off |= UART_MSR_RI;
>  		data->msr_mask_off |= UART_MSR_TERI;
>  	}
>  
>  	/* Always ask for fixed clock rate from a property. */
> -	device_property_read_u32(p->dev, "clock-frequency", &p-
> >uartclk);
> +	device_property_read_u32(dev, "clock-frequency", &p-
> >uartclk);
>  
>  	/* If there is separate baudclk, get the rate from it. */
> -	data->clk = devm_clk_get(&pdev->dev, "baudclk");
> +	data->clk = devm_clk_get(dev, "baudclk");
>  	if (IS_ERR(data->clk) && PTR_ERR(data->clk) != -EPROBE_DEFER)
> -		data->clk = devm_clk_get(&pdev->dev, NULL);
> +		data->clk = devm_clk_get(dev, NULL);
>  	if (IS_ERR(data->clk) && PTR_ERR(data->clk) == -EPROBE_DEFER)
>  		return -EPROBE_DEFER;
>  	if (!IS_ERR_OR_NULL(data->clk)) {
>  		err = clk_prepare_enable(data->clk);
>  		if (err)
> -			dev_warn(&pdev->dev, "could not enable
> optional baudclk: %d\n",
> +			dev_warn(dev, "could not enable optional
> baudclk: %d\n",
>  				 err);
>  		else
>  			p->uartclk = clk_get_rate(data->clk);
> @@ -456,11 +457,11 @@ static int dw8250_probe(struct platform_device
> *pdev)
>  
>  	/* If no clock rate is defined, fail. */
>  	if (!p->uartclk) {
> -		dev_err(&pdev->dev, "clock rate not defined\n");
> +		dev_err(dev, "clock rate not defined\n");
>  		return -EINVAL;
>  	}
>  
> -	data->pclk = devm_clk_get(&pdev->dev, "apb_pclk");
> +	data->pclk = devm_clk_get(dev, "apb_pclk");
>  	if (IS_ERR(data->clk) && PTR_ERR(data->clk) == -EPROBE_DEFER)
> {
>  		err = -EPROBE_DEFER;
>  		goto err_clk;
> @@ -468,12 +469,12 @@ static int dw8250_probe(struct platform_device
> *pdev)
>  	if (!IS_ERR(data->pclk)) {
>  		err = clk_prepare_enable(data->pclk);
>  		if (err) {
> -			dev_err(&pdev->dev, "could not enable
> apb_pclk\n");
> +			dev_err(dev, "could not enable apb_pclk\n");
>  			goto err_clk;
>  		}
>  	}
>  
> -	data->rst = devm_reset_control_get_optional(&pdev->dev,
> NULL);
> +	data->rst = devm_reset_control_get_optional(dev, NULL);
>  	if (IS_ERR(data->rst) && PTR_ERR(data->rst) == -EPROBE_DEFER)
> {
>  		err = -EPROBE_DEFER;
>  		goto err_pclk;
> @@ -505,8 +506,8 @@ static int dw8250_probe(struct platform_device
> *pdev)
>  
>  	platform_set_drvdata(pdev, data);
>  
> -	pm_runtime_set_active(&pdev->dev);
> -	pm_runtime_enable(&pdev->dev);
> +	pm_runtime_set_active(dev);
> +	pm_runtime_enable(dev);
>  
>  	return 0;
>  

-- 
Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Intel Finland Oy

  reply	other threads:[~2016-08-22 11:13 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-15 11:01 [PATCH v3 0/3] Kefeng Wang
2016-07-15 11:01 ` [PATCH v3 1/3] serial: 8250_dw: make dw8250_set_termios as default set_termios callback Kefeng Wang
2016-08-22 11:08   ` Andy Shevchenko
2016-08-24  8:09     ` Kefeng Wang
2016-07-15 11:01 ` [PATCH v3 2/3] serial: 8250_dw: Use new dev variable in probe Kefeng Wang
2016-08-22 11:13   ` Andy Shevchenko [this message]
2016-08-24  8:20     ` Kefeng Wang
2016-08-24 10:00       ` Andy Shevchenko
2016-08-24 12:06         ` Kefeng Wang
2016-07-15 11:01 ` [PATCH v3 3/3] serial: 8250_dw: add ACPI support for uart on Hisilicon Hip05 soc Kefeng Wang
2016-08-08  6:10   ` Kefeng Wang
2016-08-08  6:10     ` Kefeng Wang
2016-08-22 11:24   ` Andy Shevchenko
2016-08-22 14:05     ` Heikki Krogerus
2016-08-24  8:22       ` Kefeng Wang
2016-08-24  8:22         ` Kefeng Wang
2016-08-09 16:01 ` [PATCH v3 0/3] Andy Shevchenko
2016-08-10  5:36   ` Kefeng Wang
2016-08-19  6:26     ` Kefeng Wang
2016-08-22 11:32       ` Andy Shevchenko

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=1471864381.4887.202.camel@linux.intel.com \
    --to=andriy.shevchenko@linux.intel.com \
    --cc=graeme.gregory@linaro.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=guohanjun@huawei.com \
    --cc=jslaby@suse.com \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=wangkefeng.wang@huawei.com \
    --cc=xuwei5@hisilicon.com \
    --cc=z.liuxinliang@hisilicon.com \
    /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.