public inbox for linuxppc-dev@ozlabs.org 
 help / color / mirror / Atom feed
From: Peter Korsgaard <jacmet@sunsite•dk>
To: Grant Likely <grant.likely@secretlab•ca>
Cc: linuxppc-dev@ozlabs•org
Subject: Re: [PATCH 11/18] Virtex: Port UARTLITE driver to of-platform-bus
Date: Tue, 02 Oct 2007 17:47:32 +0200	[thread overview]
Message-ID: <87641p34dn.fsf@macbook.be.48ers.dk> (raw)
In-Reply-To: <20070928181748.18608.62409.stgit@trillian.cg.shawcable.net> (Grant Likely's message of "Fri\, 28 Sep 2007 12\:17\:49 -0600")

>>>>> "Grant" == Grant Likely <grant.likely@secretlab•ca> writes:

Hi,

 Grant> From: Grant Likely <grant.likely@secretlab•ca>
 Grant> Signed-off-by: Grant Likely <grant.likely@secretlab•ca>
 Grant> ---

 Grant>  drivers/serial/uartlite.c |  101 +++++++++++++++++++++++++++++++++++++++++----
 Grant>  1 files changed, 93 insertions(+), 8 deletions(-)

 Grant> diff --git a/drivers/serial/uartlite.c b/drivers/serial/uartlite.c
 Grant> index ed13b9f..8f742e0 100644
 Grant> --- a/drivers/serial/uartlite.c
 Grant> +++ b/drivers/serial/uartlite.c
 Grant> @@ -1,7 +1,8 @@
 Grant>  /*
 Grant>   * uartlite.c: Serial driver for Xilinx uartlite serial controller
 Grant>   *
 Grant> - * Peter Korsgaard <jacmet@sunsite•dk>
 Grant> + * Copyright (C) 2006 Peter Korsgaard <jacmet@sunsite•dk>
 Grant> + * Copyright (C) 2007 Secret Lab Technologies Ltd.
 Grant>   *
 Grant>   * This file is licensed under the terms of the GNU General Public License
 Grant>   * version 2.  This program is licensed "as is" without any warranty of any
 Grant> @@ -17,6 +18,10 @@
 Grant>  #include <linux/delay.h>
 Grant>  #include <linux/interrupt.h>
 Grant>  #include <asm/io.h>
 Grant> +#if defined(CONFIG_OF)
 Grant> +#include <linux/of_device.h>
 Grant> +#include <linux/of_platform.h>
 Grant> +#endif
 
 Grant>  #define ULITE_NAME		"ttyUL"
 Grant>  #define ULITE_MAJOR		204
 Grant> @@ -382,8 +387,10 @@ static int __init ulite_console_setup(struct console *co, char *options)
 Grant>  	port = &ulite_ports[co->index];
 
 Grant>  	/* not initialized yet? */
 Grant> -	if (!port->membase)
 Grant> +	if (!port->membase) {
 Grant> +		pr_debug("console on ttyUL%i not initialized\n", co->index);
 Grant>  		return -ENODEV;
 Grant> +	}

Unrelated change.
 
 Grant>  	if (options)
 Grant>  		uart_parse_options(options, &baud, &parity, &bits, &flow);
 Grant> @@ -542,6 +549,72 @@ static struct platform_driver ulite_platform_driver = {
 Grant>  };
 
 Grant>  /* ---------------------------------------------------------------------
 Grant> + * OF bus bindings
 Grant> + */
 Grant> +#if defined(CONFIG_OF)
 Grant> +static int __devinit
 Grant> +ulite_of_probe(struct of_device *op, const struct of_device_id *match)
 Grant> +{
 Grant> +	struct resource res;
 Grant> +	const unsigned int *id;
 Grant> +	int irq, rc;
 Grant> +
 Grant> +	dev_dbg(&op->dev, "%s(%p, %p)\n", __FUNCTION__, op, match);
 Grant> +
 Grant> +	rc = of_address_to_resource(op->node, 0, &res);
 Grant> +	if (rc) {
 Grant> +		dev_err(&op->dev, "invalide address\n");
 Grant> +		return rc;
 Grant> +	}
 Grant> +
 Grant> +	irq = irq_of_parse_and_map(op->node, 0);
 Grant> +
 Grant> +	id = of_get_property(op->node, "port-number", NULL);
 Grant> +
 Grant> +	return ulite_assign(&op->dev, id ? *id : -1, res.start, irq);
 Grant> +}
 Grant> +
 Grant> +static int ulite_of_remove(struct of_device *op)
 Grant> +{
 Grant> +	return ulite_release(&op->dev);
 Grant> +}
 Grant> +
 Grant> +/* Match table for of_platform binding */
 Grant> +static struct of_device_id __devinit ulite_of_match[] = {
 Grant> +	{ .type = "serial", .compatible = "xilinx,uartlite", },
 Grant> +	{},
 Grant> +};
 Grant> +MODULE_DEVICE_TABLE(of, ulite_of_match);
 Grant> +
 Grant> +static struct of_platform_driver ulite_of_driver = {
 Grant> +	.owner = THIS_MODULE,
 Grant> +	.name = "uartlite",
 Grant> +	.match_table = ulite_of_match,
 Grant> +	.probe = ulite_of_probe,
 Grant> +	.remove = ulite_of_remove,
 Grant> +	.driver = {
 Grant> +		.name = "uartlite",
 Grant> +	},
 Grant> +};
 Grant> +
 Grant> +/* Registration helpers to keep the number of #ifdefs to a minimum */
 Grant> +static inline int __init ulite_of_register(void)
 Grant> +{
 Grant> +	pr_debug("uartlite: calling of_register_platform_driver()\n");
 Grant> +	return of_register_platform_driver(&ulite_of_driver);
 Grant> +}
 Grant> +
 Grant> +static inline void __init ulite_of_unregister(void)
 Grant> +{
 Grant> +	of_unregister_platform_driver(&ulite_of_driver);
 Grant> +}
 Grant> +#else /* CONFIG_OF */
 Grant> +/* CONFIG_OF not enabled; do nothing helpers */
 Grant> +static inline int __init ulite_of_register(void) { return 0; }
 Grant> +static inline void __init ulite_of_unregister(void) { }
 Grant> +#endif /* CONFIG_OF */
 Grant> +
 Grant> +/* ---------------------------------------------------------------------
 Grant>   * Module setup/teardown
 Grant>   */
 
 Grant> @@ -549,20 +622,32 @@ int __init ulite_init(void)
 Grant>  {
 Grant>  	int ret;
 
 Grant> -	ret = uart_register_driver(&ulite_uart_driver);
 Grant> -	if (ret)
 Grant> -		return ret;
 Grant> +	pr_debug("uartlite: calling uart_register_driver()\n");
 Grant> +	if ((ret = uart_register_driver(&ulite_uart_driver)) != 0)
 Grant> +		goto err_uart;
 
 Grant> -	ret = platform_driver_register(&ulite_platform_driver);
 Grant> -	if (ret)
 Grant> -		uart_unregister_driver(&ulite_uart_driver);
 Grant> +	if ((ret = ulite_of_register()) != 0)
 Grant> +		goto err_of;
 
 Grant> +	pr_debug("uartlite: calling platform_driver_register()\n");
 Grant> +	if ((ret = platform_driver_register(&ulite_platform_driver)) != 0)

I prefer to not have assignments in the if ().
Are all the pr_debug necessary? It looks quite messy.

 Grant> +		goto err_plat;
 Grant> +

 Grant> +	return 0;
 Grant> +
 Grant> +err_plat:
 Grant> +	ulite_of_unregister();
 Grant> +err_of:
 Grant> +	uart_unregister_driver(&ulite_uart_driver);
 Grant> +err_uart:
 Grant> +	printk(KERN_ERR "registering uartlite driver failed: err=%i", ret);
 Grant>  	return ret;
 Grant>  }
 
 Grant>  void __exit ulite_exit(void)
 Grant>  {
 Grant>  	platform_driver_unregister(&ulite_platform_driver);
 Grant> +	ulite_of_unregister();
 Grant>  	uart_unregister_driver(&ulite_uart_driver);
 Grant>  }
 


-- 
Bye, Peter Korsgaard

  parent reply	other threads:[~2007-10-02 15:47 UTC|newest]

Thread overview: 55+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-09-28 18:15 [PATCH 00/18] Virtex support in arch/powerpc Grant Likely
2007-09-28 18:15 ` [PATCH 01/18] Virtex: Add uartlite bootwrapper driver Grant Likely
2007-09-28 19:45   ` Arnd Bergmann
2007-09-28 20:04     ` Grant Likely
2007-09-28 20:26       ` Josh Boyer
2007-09-28 23:31         ` Arnd Bergmann
2007-10-02 15:04   ` Peter Korsgaard
2007-10-02 15:12     ` Grant Likely
2007-09-28 18:16 ` [PATCH 02/18] Add Kconfig macros for Xilinx Virtex support Grant Likely
2007-09-28 18:20   ` Scott Wood
2007-09-28 19:35     ` Grant Likely
2007-09-28 20:19   ` Olof Johansson
2007-09-28 20:39     ` Grant Likely
2007-09-28 18:16 ` [PATCH 03/18] Virtex: add xilinx interrupt controller driver Grant Likely
2007-09-28 20:17   ` Olof Johansson
2007-09-28 20:26     ` Grant Likely
2007-09-28 18:16 ` [PATCH 04/18] Xilinx Virtex: Add generic virtex board support Grant Likely
2007-09-28 18:16 ` [PATCH 05/18] Add PowerPC Xilinx Virtex entry to maintainers Grant Likely
2007-09-28 19:05   ` Grant Likely
2007-10-02  0:40     ` Paul Mackerras
2007-10-02 15:26   ` Peter Korsgaard
2007-09-28 18:17 ` [PATCH 06/18] [POWERPC] Fix UARTLITE reg io for little-endian architectures (ie. microblaze) Grant Likely
2007-09-28 20:31   ` Olof Johansson
2007-09-28 20:42     ` Grant Likely
2007-09-28 20:47       ` Olof Johansson
2007-09-28 20:50         ` Grant Likely
2007-09-28 20:52           ` Grant Likely
2007-10-02 15:40   ` Peter Korsgaard
2007-10-02 15:54     ` Grant Likely
2007-09-28 18:17 ` [PATCH 07/18] Uartlite: change name of ports to ulite_ports Grant Likely
2007-10-02 15:27   ` Peter Korsgaard
2007-09-28 18:17 ` [PATCH 08/18] Uartlite: Add macro for uartlite device name Grant Likely
2007-10-02 15:29   ` Peter Korsgaard
2007-10-02 15:34     ` Grant Likely
2007-09-28 18:17 ` [PATCH 09/18] Uartlite: Separate the bus binding from the driver proper Grant Likely
2007-09-28 18:17 ` [PATCH 10/18] Uartlite: improve in-code comments Grant Likely
2007-09-28 19:43   ` Arnd Bergmann
2007-09-28 20:02     ` Grant Likely
2007-10-02 15:24   ` Peter Korsgaard
2007-09-28 18:17 ` [PATCH 11/18] Virtex: Port UARTLITE driver to of-platform-bus Grant Likely
2007-09-28 19:32   ` Arnd Bergmann
2007-10-02 15:47   ` Peter Korsgaard [this message]
2007-10-02 15:56     ` Grant Likely
2007-10-02 16:01       ` Peter Korsgaard
2007-09-28 18:17 ` [PATCH 12/18] Uartlite: Let the console be initialized earlier Grant Likely
2007-09-28 19:40   ` Arnd Bergmann
2007-09-28 20:01     ` Grant Likely
2007-09-28 18:18 ` [PATCH 13/18] Add Xilinx SystemACE entry to maintainers Grant Likely
2007-09-28 18:18 ` [PATCH 14/18] Sysace: Use the established platform bus api Grant Likely
2007-09-28 18:18 ` [PATCH 15/18] Sysace: Move structure allocation from bus binding into common code Grant Likely
2007-09-28 18:18 ` [PATCH 16/18] Sysace: minor rework and cleanup changes Grant Likely
2007-09-28 18:18 ` [PATCH 17/18] Sysace: Move IRQ handler registration to occur after FSM is initialized Grant Likely
2007-09-28 18:18 ` [PATCH 18/18] xsysace: Add of_platform_bus binding Grant Likely
2007-09-28 19:46 ` [PATCH 00/18] Virtex support in arch/powerpc Arnd Bergmann
2007-09-28 20:05   ` Grant Likely

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=87641p34dn.fsf@macbook.be.48ers.dk \
    --to=jacmet@sunsite$(echo .)dk \
    --cc=grant.likely@secretlab$(echo .)ca \
    --cc=linuxppc-dev@ozlabs$(echo .)org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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