Re: [PATCH] max3100 driver

Jiri Slaby
2007-12-17T08:45:40Z

On 12/17/2007 09:17 AM, chripell@gmail.com wrote:
> This patch adds support for the MAX3100 SPI UART.
>
> Generated on 20071217 against v2.6.23
>
> Signed-off-by: Christian Pellegrin <chripell@fsfe.org>
> ---
> drivers/serial/Kconfig | 7 +
> drivers/serial/Makefile | 1 +
> drivers/serial/max3100.c | 956 ++++++++++++++++++++++++++++++++++++++++
> include/linux/serial_max3100.h | 25 +
> 4 files changed, 989 insertions(+), 0 deletions(-)
>
[...]
> diff --git a/drivers/serial/max3100.c b/drivers/serial/max3100.c
> new file mode 100644
> index 0000000..d07936d
> --- /dev/null
> +++ b/drivers/serial/max3100.c
[...]
> +static int __devexit max3100_remove(struct spi_device *spi)
> +{
> + int i;
> +
> + i = 0;
> +
> + for (i = 0; i < MAX_MAX3100; i++)
> + if (max3100s[i] && max3100s[i]->ref_count > 0)
> + return -EBUSY;
> +
> + for (i = 0; i < MAX_MAX3100; i++)
> + if (max3100s[i]) {
> + tty_unregister_device(serial_driver, i);
> + kfree(max3100s[i]);
> + max3100s[i] = NULL;
> + }
> +
> + if (serial_driver)
> + tty_unregister_driver(serial_driver);

You probably wanted to unregister it after _all_ cards are removed, not after
each...

> + return 0;
> +}
> +
> +#ifdef CONFIG_PM
> +static int max3100_suspend(struct spi_device *spi, pm_message_t state)
> +{
> + struct max3100_port_s *s = dev_get_drvdata(&spi->dev);
> + u16 tx, rx;
> +
> + tx = MAX3100_WC | MAX3100_SHDN;
> + max3100_sr(s, tx, &rx, 0);

Also you should synchronize_irq() after stopping them here.

> + return 0;
> +}

regards,
--
Jiri Slaby (jirislaby@gmail.com)
Faculty of Informatics, Masaryk University