Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 696faedd authored by Jingoo Han's avatar Jingoo Han Committed by Greg Kroah-Hartman
Browse files

serial: use platform_{get,set}_drvdata()



Use the wrapper functions for getting and setting the driver data using
platform_device instead of using dev_{get,set}_drvdata() with &pdev->dev,
so we can directly pass a struct platform_device.

Also, unnecessary dev_set_drvdata() is removed, because the driver core
clears the driver data to NULL after device_release or on probe failure.

Signed-off-by: default avatarJingoo Han <jg1.han@samsung.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 9d141cb9
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -1384,7 +1384,7 @@ static int cpm_uart_probe(struct platform_device *ofdev)
	if (index >= UART_NR)
		return -ENODEV;

	dev_set_drvdata(&ofdev->dev, pinfo);
	platform_set_drvdata(ofdev, pinfo);

	/* initialize the device pointer for the port */
	pinfo->port.dev = &ofdev->dev;
@@ -1398,7 +1398,7 @@ static int cpm_uart_probe(struct platform_device *ofdev)

static int cpm_uart_remove(struct platform_device *ofdev)
{
	struct uart_cpm_port *pinfo = dev_get_drvdata(&ofdev->dev);
	struct uart_cpm_port *pinfo = platform_get_drvdata(ofdev);
	return uart_remove_one_port(&cpm_reg, &pinfo->port);
}

+4 −5
Original line number Diff line number Diff line
@@ -1362,15 +1362,14 @@ static int mpc52xx_uart_of_probe(struct platform_device *op)
	if (ret)
		return ret;

	dev_set_drvdata(&op->dev, (void *)port);
	platform_set_drvdata(op, (void *)port);
	return 0;
}

static int
mpc52xx_uart_of_remove(struct platform_device *op)
{
	struct uart_port *port = dev_get_drvdata(&op->dev);
	dev_set_drvdata(&op->dev, NULL);
	struct uart_port *port = platform_get_drvdata(op);

	if (port)
		uart_remove_one_port(&mpc52xx_uart_driver, port);
@@ -1382,7 +1381,7 @@ mpc52xx_uart_of_remove(struct platform_device *op)
static int
mpc52xx_uart_of_suspend(struct platform_device *op, pm_message_t state)
{
	struct uart_port *port = (struct uart_port *) dev_get_drvdata(&op->dev);
	struct uart_port *port = (struct uart_port *) platform_get_drvdata(op);

	if (port)
		uart_suspend_port(&mpc52xx_uart_driver, port);
@@ -1393,7 +1392,7 @@ mpc52xx_uart_of_suspend(struct platform_device *op, pm_message_t state)
static int
mpc52xx_uart_of_resume(struct platform_device *op)
{
	struct uart_port *port = (struct uart_port *) dev_get_drvdata(&op->dev);
	struct uart_port *port = (struct uart_port *) platform_get_drvdata(op);

	if (port)
		uart_resume_port(&mpc52xx_uart_driver, port);
+2 −2
Original line number Diff line number Diff line
@@ -204,7 +204,7 @@ static int of_platform_serial_probe(struct platform_device *ofdev)

	info->type = port_type;
	info->line = ret;
	dev_set_drvdata(&ofdev->dev, info);
	platform_set_drvdata(ofdev, info);
	return 0;
out:
	kfree(info);
@@ -217,7 +217,7 @@ out:
 */
static int of_platform_serial_remove(struct platform_device *ofdev)
{
	struct of_serial_info *info = dev_get_drvdata(&ofdev->dev);
	struct of_serial_info *info = platform_get_drvdata(ofdev);
	switch (info->type) {
#ifdef CONFIG_SERIAL_8250
	case PORT_8250 ... PORT_MAX_8250:
+2 −3
Original line number Diff line number Diff line
@@ -696,7 +696,7 @@ static int sc26xx_probe(struct platform_device *dev)
	if (err)
		goto out_remove_ports;

	dev_set_drvdata(&dev->dev, up);
	platform_set_drvdata(dev, up);
	return 0;

out_remove_ports:
@@ -716,7 +716,7 @@ out_free_port:

static int __exit sc26xx_driver_remove(struct platform_device *dev)
{
	struct uart_sc26xx_port *up = dev_get_drvdata(&dev->dev);
	struct uart_sc26xx_port *up = platform_get_drvdata(dev);

	free_irq(up->port[0].irq, up);

@@ -728,7 +728,6 @@ static int __exit sc26xx_driver_remove(struct platform_device *dev)
	kfree(up);
	sc26xx_port = NULL;

	dev_set_drvdata(&dev->dev, NULL);
	return 0;
}

+2 −4
Original line number Diff line number Diff line
@@ -577,7 +577,7 @@ static int hv_probe(struct platform_device *op)
	if (err)
		goto out_remove_port;

	dev_set_drvdata(&op->dev, port);
	platform_set_drvdata(op, port);

	return 0;

@@ -601,7 +601,7 @@ out_free_port:

static int hv_remove(struct platform_device *dev)
{
	struct uart_port *port = dev_get_drvdata(&dev->dev);
	struct uart_port *port = platform_get_drvdata(dev);

	free_irq(port->irq, port);

@@ -612,8 +612,6 @@ static int hv_remove(struct platform_device *dev)
	kfree(port);
	sunhv_port = NULL;

	dev_set_drvdata(&dev->dev, NULL);

	return 0;
}

Loading