powerpc: Xilinx: PS2: Added new XPS PS2 driver
Subsystems (3)
PATCH 1/1 powerpc: Xilinx: PS2: Added new XPS PS2 driver
Added a new driver for Xilinx XPS PS2 IP. This driver is a flat driver to better match the Linux driver pattern.
--- drivers/input/serio/Kconfig | 5 + drivers/input/serio/Makefile | 1 + drivers/input/serio/xilinx_ps2.c | 464 ++++++++++++++++++++++++++++++++++++++ drivers/input/serio/xilinx_ps2.h | 97 ++++++++ 4 files changed, 567 insertions(+), 0 deletions(-) create mode 100644 drivers/input/serio/xilinx_ps2.c create mode 100644 drivers/input/serio/xilinx_ps2.h
drivers/input/serio/Kconfig +5 -0
@@ -190,4 +190,9 @@ config SERIO_RAW To compile this driver as a module, choose M here: the module will be called serio_raw. +config SERIO_XILINX_XPS_PS2 + tristate "Xilinx XPS PS/2 Controller Support" + help + This driver supports XPS PS/2 IP from Xilinx EDK. + endif
drivers/input/serio/Makefile +1 -0
@@ -21,3 +21,4 @@ obj-$(CONFIG_SERIO_PCIPS2) += pcips2.o obj-$(CONFIG_SERIO_MACEPS2) += maceps2.o obj-$(CONFIG_SERIO_LIBPS2) += libps2.o obj-$(CONFIG_SERIO_RAW) += serio_raw.o +obj-$(CONFIG_SERIO_XILINX_XPS_PS2) += xilinx_ps2.o
drivers/input/serio/xilinx_ps2.c new file +464 -0
464 lines not on this page · raw message
drivers/input/serio/xilinx_ps2.h new file +97 -0
97 lines not on this page · raw message
Signature · 5 lines
1.5.2.1 This email and any attachments are intended for the sole use of the named recipient(s) and contain(s) confidential information that may be proprietary, privileged or copyrighted under applicable law. If you are not the intended recipient, do not read, copy, or forward this email message or any attachments. Delete this email message and any attachments immediately.
Quoted 4 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"John" == John Linn <[email protected]> writes:
Added a new driver for Xilinx XPS PS2 IP. This driver is a flat driver to better match the Linux driver pattern.
This should probably go to the linux-input@ list as well.
Quoted 41 lines
Signed-off-by Sadanand <[email protected]>Signed-off-by John Linn <[email protected]>--- drivers/input/serio/Kconfig | 5 + drivers/input/serio/Makefile | 1 + drivers/input/serio/xilinx_ps2.c | 464 ++++++++++++++++++++++++++++++++++++++ drivers/input/serio/xilinx_ps2.h | 97 ++++++++ 4 files changed, 567 insertions(+), 0 deletions(-) create mode 100644 drivers/input/serio/xilinx_ps2.c create mode 100644 drivers/input/serio/xilinx_ps2.hdrivers/input/serio/Kconfig +5
-0@@ -190,4 +190,9 @@ config SERIO_RAW To compile this driver as a module, choose M here: the module will be called serio_raw. +config SERIO_XILINX_XPS_PS2 + tristate "Xilinx XPS PS/2 Controller Support" + help + This driver supports XPS PS/2 IP from Xilinx EDK. + endifdrivers/input/serio/Makefile +1
-0@@ -21,3 +21,4 @@ obj-$(CONFIG_SERIO_PCIPS2) += pcips2.o obj-$(CONFIG_SERIO_MACEPS2) += maceps2.o obj-$(CONFIG_SERIO_LIBPS2) += libps2.o obj-$(CONFIG_SERIO_RAW) += serio_raw.o +obj-$(CONFIG_SERIO_XILINX_XPS_PS2) += xilinx_ps2.odrivers/input/serio/xilinx_ps2.c new file +1
-0@@ -0,0 +1,464 @@ +/*
drivers/input/serio/xilinx_ps2.c line 11
Quoted 10 lines
drivers/input/serio/xilinx_ps2.c new file +10
-0+* xilinx_ps2.c +* +* Xilinx PS/2 driver to interface PS/2 component to Linux +* +* Author: MontaVista Software, Inc. +* [email protected] +* +* (c) 2005 MontaVista Software, Inc. +* (c) 2008 Xilinx Inc. +*
Is the montavista stuff still valid?
Quoted 8 lines
drivers/input/serio/xilinx_ps2.c new file +8
-0+* This program is free software; you can redistribute it and/or modify it +* under the terms of the GNU General Public License as published by the +* Free Software Foundation; either version 2 of the License, or (at your +* option) any later version. +* +* You should have received a copy of the GNU General Public License along +* with this program; if not, write to the Free Software Foundation, Inc., +* 675 Mass Ave, Cambridge, MA 02139, USA.
drivers/input/serio/xilinx_ps2.c line 29
Quoted 10 lines
drivers/input/serio/xilinx_ps2.c new file +10
-0+*/ + + +#include <linux/module.h> +#include <linux/serio.h> +#include <linux/interrupt.h> +#include <linux/errno.h> +#include <linux/init.h> +#include <linux/list.h> +#include <asm/io.h>
linux/io.h please.
drivers/input/serio/xilinx_ps2.c line 31
Quoted 2 lines
drivers/input/serio/xilinx_ps2.c new file +2
-0+ +#ifdef CONFIG_OF /* For open firmware */
Why support !CONFIG_OF?
drivers/input/serio/xilinx_ps2.c line 36
Quoted 5 lines
drivers/input/serio/xilinx_ps2.c new file +5
-0+#include <linux/of_device.h> +#include <linux/of_platform.h> +#endif /* CONFIG_OF */ + +#include "xilinx_ps2.h"
Why the seperate header? You're the only user of it, right?
drivers/input/serio/xilinx_ps2.c line 42
Quoted 6 lines
drivers/input/serio/xilinx_ps2.c new file +6
-0+ +#define DRIVER_NAME "xilinx_ps2" +#define DRIVER_DESCRIPTION "Xilinx XPS PS/2 driver" + +#define XPS2_NAME_DESC "Xilinx XPS PS/2 Port #%d" +#define XPS2_PHYS_DESC "xilinxps2/serio%d"
Why have defines to stuff only used once?
...
drivers/input/serio/xilinx_ps2.c line 251
Quoted 6 lines
drivers/input/serio/xilinx_ps2.c new file +6
-0+ +/******************************/ +/* The platform device driver */ +/******************************/ + +static int xps2_probe (struct device *dev)
__devinit please.
Quoted 16 lines
drivers/input/serio/xilinx_ps2.c new file +16
-0+{ +struct platform_device *pdev =to_platform_device (dev); + +struct resource *irq_res =NULL ;/* Interrupt resources */ +struct resource *regs_res =NULL ;/* IO mem resources */ + +if (!dev) { +dev_err (dev,"Probe called with NULL param\n" ); +return -EINVAL ; + } + +/* Find irq number, map the control registers in */ + irq_res =platform_get_resource (pdev,IORESOURCE_IRQ ,0 ); + regs_res =platform_get_resource (pdev,IORESOURCE_MEM ,0 ); +return xps2_setup (dev, pdev->id, regs_res, irq_res); +}
...
drivers/input/serio/xilinx_ps2.c line 361
Quoted 5 lines
drivers/input/serio/xilinx_ps2.c new file +5
-0+ +/* +* xps2_remove() dissociates the driver with the Xilinx PS/2 device. +*/ +static int xps2_remove (struct device *dev)
__devexit please.
Quoted 11 lines
drivers/input/serio/xilinx_ps2.c new file +11
-0+{ +struct xps2data *drvdata; + +if (!dev) +return -EINVAL ; + + drvdata = (struct xps2data *)dev_get_drvdata (dev); + +serio_unregister_port (&drvdata->serio); + +iounmap (drvdata->base_address);
drivers/input/serio/xilinx_ps2.c line 382
Quoted 10 lines
drivers/input/serio/xilinx_ps2.c new file +10
-0+ +release_mem_region (drvdata->phys_addr, drvdata->remap_size); + +kfree (drvdata); +dev_set_drvdata (dev,NULL ); + +return 0 ;/* success */ +} + +static struct device_driver xps2_driver = {
Please use a real struct platform_driver instead.
Quoted 6 lines
drivers/input/serio/xilinx_ps2.c new file +6
-0+ .name = DRIVER_NAME, + .bus = &platform_bus_type, + .probe = xps2_probe, + .remove = xps2_remove +}; +
Signature · 1 line
Bye, Peter Korsgaard
Thanks Peter, will do.
-----Original Message-----
From: Peter Korsgaard [mailto:[email protected]] On Behalf Of Peter Korsgaard
Sent: Monday, June 30, 2008 8:45 AM
To: John Linn
Cc: [email protected]; Sadanand Mutyala
Subject: Re: [PATCH] powerpc: Xilinx: PS2: Added new XPS PS2 driver
Quoted 4 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"John" =3D=3D John Linn <[email protected]> writes:
Added a new driver for Xilinx XPS PS2 IP. This driver is a flat driver to better match the Linux driver pattern.
This should probably go to the linux-input@ list as well.
Quoted 6 lines
Signed-off-by Sadanand <[email protected]>Signed-off-by John Linn <[email protected]>--- drivers/input/serio/Kconfig | 5 + drivers/input/serio/Makefile | 1 + drivers/input/serio/xilinx_ps2.c | 464
++++++++++++++++++++++++++++++++++++++
Review
Quoted 6 lines
drivers/input/serio/xilinx_ps2.h | 97 ++++++++ 4 files changed, 567 insertions(+), 0 deletions(-) create mode 100644 drivers/input/serio/xilinx_ps2.c create mode 100644 drivers/input/serio/xilinx_ps2.h(quoted diff) +0
-0
b/drivers/input/serio/Kconfig
drivers/input/serio/Kconfig config SERIO_RAW · line 191
Quoted 6 lines
index ec4b661..0e62b39 100644
drivers/input/serio/Kconfig +0
-0@@ -190,4 +190,9 @@ config SERIO_RAW To compile this driver as a module, choose M here: the module will be called serio_raw.
=
Review
Quoted 7 lines
drivers/input/serio/Kconfig +5
-0+config SERIO_XILINX_XPS_PS2 + tristate "Xilinx XPS PS/2 Controller Support" + help + This driver supports XPS PS/2 IP from Xilinx EDK. + endif(quoted diff) +0
-0
b/drivers/input/serio/Makefile
Review
Quoted 9 lines
index 38b8868..9b6c813 100644
drivers/input/serio/Makefile +1
-0@@ -21,3 +21,4 @@ obj-$(CONFIG_SERIO_PCIPS2) +=3D pcips2.o obj-$(CONFIG_SERIO_MACEPS2) +=3D maceps2.o obj-$(CONFIG_SERIO_LIBPS2) +=3D libps2.o obj-$(CONFIG_SERIO_RAW) +=3D serio_raw.o +obj-$(CONFIG_SERIO_XILINX_XPS_PS2) +=3D xilinx_ps2.o(quoted diff) +0
-0
b/drivers/input/serio/xilinx_ps2.c
Quoted 6 lines
new file mode 100644
index 0000000..670d47fdrivers/input/serio/xilinx_ps2.c new file +1
-0@@ -0,0 +1,464 @@ +/*
drivers/input/serio/xilinx_ps2.c line 11
Quoted 10 lines
drivers/input/serio/xilinx_ps2.c new file +10
-0+* xilinx_ps2.c +* +* Xilinx PS/2 driver to interface PS/2 component to Linux +* +* Author: MontaVista Software, Inc. +* [email protected] +* +* (c) 2005 MontaVista Software, Inc. +* (c) 2008 Xilinx Inc. +*
Is the montavista stuff still valid?
drivers/input/serio/xilinx_ps2.c line 12
Quoted 1 line
drivers/input/serio/xilinx_ps2.c new file +1
-0+* This program is free software; you can redistribute it and/or
modify it
drivers/input/serio/xilinx_ps2.c line 13
Quoted 1 line
drivers/input/serio/xilinx_ps2.c new file +1
-0+* under the terms of the GNU General Public License as published by
the
drivers/input/serio/xilinx_ps2.c line 14
Quoted 1 line
drivers/input/serio/xilinx_ps2.c new file +1
-0+* Free Software Foundation; either version 2 of the License, or (at
your
drivers/input/serio/xilinx_ps2.c
Quoted 3 lines
drivers/input/serio/xilinx_ps2.c new file +3
-0+* option) any later version. +* +* You should have received a copy of the GNU General Public License
along
drivers/input/serio/xilinx_ps2.c line 18
Quoted 1 line
drivers/input/serio/xilinx_ps2.c new file +1
-0+* with this program; if not, write to the Free Software Foundation,
Inc.,
drivers/input/serio/xilinx_ps2.c line 29
Quoted 11 lines
drivers/input/serio/xilinx_ps2.c new file +11
-0+* 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + + +#include <linux/module.h> +#include <linux/serio.h> +#include <linux/interrupt.h> +#include <linux/errno.h> +#include <linux/init.h> +#include <linux/list.h> +#include <asm/io.h>
linux/io.h please.
drivers/input/serio/xilinx_ps2.c line 31
Quoted 2 lines
drivers/input/serio/xilinx_ps2.c new file +2
-0+ +#ifdef CONFIG_OF /* For open firmware */
Why support !CONFIG_OF? =
drivers/input/serio/xilinx_ps2.c line 36
Quoted 5 lines
drivers/input/serio/xilinx_ps2.c new file +5
-0+#include <linux/of_device.h> +#include <linux/of_platform.h> +#endif /* CONFIG_OF */ + +#include "xilinx_ps2.h"
Why the seperate header? You're the only user of it, right?
drivers/input/serio/xilinx_ps2.c line 42
Quoted 6 lines
drivers/input/serio/xilinx_ps2.c new file +6
-0+ +#define DRIVER_NAME "xilinx_ps2" +#define DRIVER_DESCRIPTION "Xilinx XPS PS/2 driver" + +#define XPS2_NAME_DESC "Xilinx XPS PS/2 Port #%d" +#define XPS2_PHYS_DESC "xilinxps2/serio%d"
Why have defines to stuff only used once?
...
drivers/input/serio/xilinx_ps2.c line 251
Quoted 6 lines
drivers/input/serio/xilinx_ps2.c new file +6
-0+ +/******************************/ +/* The platform device driver */ +/******************************/ + +static int xps2_probe (struct device *dev)
__devinit please.
drivers/input/serio/xilinx_ps2.c
Quoted 4 lines
drivers/input/serio/xilinx_ps2.c new file +4
-0+{ + struct platform_device *pdev =3D to_platform_device(dev); + + struct resource *irq_res =3D NULL; /* Interrupt resources
*/
Quoted 12 lines
drivers/input/serio/xilinx_ps2.c new file +12
-0+ struct resource *regs_res =3D NULL; /* IO mem resources */ + +if (!dev) { +dev_err (dev,"Probe called with NULL param\n" ); +return -EINVAL ; + } + +/* Find irq number, map the control registers in */ + irq_res =3D platform_get_resource(pdev, IORESOURCE_IRQ, 0); + regs_res =3D platform_get_resource(pdev, IORESOURCE_MEM, 0); +return xps2_setup (dev, pdev->id, regs_res, irq_res); +}
...
drivers/input/serio/xilinx_ps2.c line 361
Quoted 5 lines
drivers/input/serio/xilinx_ps2.c new file +5
-0+ +/* +* xps2_remove() dissociates the driver with the Xilinx PS/2 device. +*/ +static int xps2_remove (struct device *dev)
__devexit please.
Quoted 11 lines
drivers/input/serio/xilinx_ps2.c new file +11
-0+{ +struct xps2data *drvdata; + +if (!dev) +return -EINVAL ; + + drvdata =3D (struct xps2data *)dev_get_drvdata(dev); + + serio_unregister_port(&drvdata->serio); + + iounmap(drvdata->base_address);
drivers/input/serio/xilinx_ps2.c
Quoted 10 lines
drivers/input/serio/xilinx_ps2.c new file +10
-0+ +release_mem_region (drvdata->phys_addr, drvdata->remap_size); + +kfree (drvdata); +dev_set_drvdata (dev,NULL ); + +return 0 ;/* success */ +} + +static struct device_driver xps2_driver =3D {
Please use a real struct platform_driver instead.
drivers/input/serio/xilinx_ps2.c
Quoted 6 lines
drivers/input/serio/xilinx_ps2.c new file +6
-0+ .name =3D DRIVER_NAME, + .bus =3D &platform_bus_type, + .probe =3D xps2_probe, + .remove =3D xps2_remove +}; +
-- =
Bye, Peter Korsgaard
This email and any attachments are intended for the sole use of the named r= ecipient(s) and contain(s) confidential information that may be proprietary= , privileged or copyrighted under applicable law. If you are not the intend= ed recipient, do not read, copy, or forward this email message or any attac= hments. Delete this email message and any attachments immediately.
Quoted 5 lines · John Linn
Added a new driver for Xilinx XPS PS2 IP. This driver is a flat driver to better match the Linux driver pattern.
Signed-off-by Sadanand <[email protected]>Signed-off-by John Linn <[email protected]>
I don't know much about the serio conventions, but I can make some general comments...
from MAINTAINERS:
INPUT (KEYBOARD, MOUSE, JOYSTICK, TOUCHSCREEN) DRIVERS
P: Dmitry Torokhov
M: [email protected]
M: [email protected]
L: [email protected]
T: git kernel.org:/pub/scm/linux/kernel/git/dtor/input.git
S: Maintained
You need to cc: the linux-input mailing list and Dimitry when you post the next version of this driver.
Quoted 14 lines
--- drivers/input/serio/Kconfig | 5 + drivers/input/serio/Makefile | 1 + drivers/input/serio/xilinx_ps2.c | 464 ++++++++++++++++++++++++++++++++++++++ drivers/input/serio/xilinx_ps2.h | 97 ++++++++ 4 files changed, 567 insertions(+), 0 deletions(-) create mode 100644 drivers/input/serio/xilinx_ps2.c create mode 100644 drivers/input/serio/xilinx_ps2.hdrivers/input/serio/Kconfig +0
-0
drivers/input/serio/Kconfig config SERIO_RAW · line 197
Quoted 8 lines
drivers/input/serio/Kconfig +5
-0@@ -190,4 +190,9 @@ config SERIO_RAW To compile this driver as a module, choose M here: the module will be called serio_raw. +config SERIO_XILINX_XPS_PS2 + tristate "Xilinx XPS PS/2 Controller Support" + help + This driver supports XPS PS/2 IP from Xilinx EDK. +
Consider moving this block to somewhere in the middle of the file to reduce the possibility of merge conflicts.
drivers/input/serio/Makefile obj-$(CONFIG_SERIO_PCIPS2) += pcips2.o · line 24
Quoted 10 lines
drivers/input/serio/Kconfig +0
-0endifdrivers/input/serio/Makefile +1
-0@@ -21,3 +21,4 @@ obj-$(CONFIG_SERIO_PCIPS2) += pcips2.o obj-$(CONFIG_SERIO_MACEPS2) += maceps2.o obj-$(CONFIG_SERIO_LIBPS2) += libps2.o obj-$(CONFIG_SERIO_RAW) += serio_raw.o +obj-$(CONFIG_SERIO_XILINX_XPS_PS2) += xilinx_ps2.o
Ditto.
drivers/input/serio/xilinx_ps2.c line 2
Quoted 8 lines
drivers/input/serio/xilinx_ps2.c new file +2
-0@@ -0,0 +1,464 @@ +/* +* xilinx_ps2.c
Don't put the .c filename in the header block.
drivers/input/serio/xilinx_ps2.c line 7
Quoted 5 lines
drivers/input/serio/xilinx_ps2.c new file +5
-0+* +* Xilinx PS/2 driver to interface PS/2 component to Linux +* +* Author: MontaVista Software, Inc. +* [email protected]
Is this true anymore?
drivers/input/serio/xilinx_ps2.c line 19
Quoted 12 lines
drivers/input/serio/xilinx_ps2.c new file +12
-0+* +* (c) 2005 MontaVista Software, Inc. +* (c) 2008 Xilinx Inc. +* +* This program is free software; you can redistribute it and/or modify it +* under the terms of the GNU General Public License as published by the +* Free Software Foundation; either version 2 of the License, or (at your +* option) any later version. +* +* You should have received a copy of the GNU General Public License along +* with this program; if not, write to the Free Software Foundation, Inc., +* 675 Mass Ave, Cambridge, MA 02139, USA.
These two paragraphs are redundant. Being in the Linux source tree implies that it is GPL licensed. You can remove them.
Quoted 5 lines
drivers/input/serio/xilinx_ps2.c new file +5
-0+*/ + + +#include <linux/module.h> +#include <linux/serio.h>
drivers/input/serio/xilinx_ps2.c line 34
Quoted 10 lines
drivers/input/serio/xilinx_ps2.c new file +10
-0+#include <linux/interrupt.h> +#include <linux/errno.h> +#include <linux/init.h> +#include <linux/list.h> +#include <asm/io.h> + +#ifdef CONFIG_OF /* For open firmware */ +#include <linux/of_device.h> +#include <linux/of_platform.h> +#endif /* CONFIG_OF */
This is a given for mainline since arch/ppc will not exist in 2.6.27
drivers/input/serio/xilinx_ps2.c line 36
Quoted 2 lines
drivers/input/serio/xilinx_ps2.c new file +2
-0+ +#include "xilinx_ps2.h"
This header can simple be rolled into this .c file because the driver no longer has multiple .c files.
drivers/input/serio/xilinx_ps2.c line 42
Quoted 3 lines
drivers/input/serio/xilinx_ps2.c new file +3
-0+#define DRIVER_DESCRIPTION "Xilinx XPS PS/2 driver" +#define XPS2_NAME_DESC "Xilinx XPS PS/2 Port #%d" +#define XPS2_PHYS_DESC "xilinxps2/serio%d"
These strings are only used in 1 place each, no need to use a #define
drivers/input/serio/xilinx_ps2.c line 45
Quoted 3 lines
drivers/input/serio/xilinx_ps2.c new file +3
-0+ + +static DECLARE_MUTEX (cfg_sem);
This mutex should be part of the driver private data structure
Quoted 63 lines
drivers/input/serio/xilinx_ps2.c new file +63
-0+ +/*********************/ +/* Interrupt handler */ +/*********************/ +static irqreturn_t xps2_interrupt (int irq,void *dev_id) +{ +struct xps2data *drvdata = (struct xps2data *)dev_id; +u32 intr_sr; +u32 ier; +u8 c; +u8 retval; + +/* Get the PS/2 interrupts and clear them */ + intr_sr =in_be32 (drvdata->base_address +XPS2_IPISR_OFFSET ); +out_be32 (drvdata->base_address +XPS2_IPISR_OFFSET , intr_sr); + +/* Check which interrupt is active */ +if (intr_sr &XPS2_IPIXR_RX_OVF ) { +printk (KERN_ERR "%s: receive overrun error\n" , + drvdata->serio.name); + } + +if (intr_sr &XPS2_IPIXR_RX_ERR ) { + drvdata->dfl |=SERIO_PARITY ; + } + +if (intr_sr & (XPS2_IPIXR_TX_NOACK |XPS2_IPIXR_WDT_TOUT )) { + drvdata->dfl |=SERIO_TIMEOUT ; + } + +if (intr_sr &XPS2_IPIXR_RX_FULL ) { + retval =xps2_recv (drvdata, &drvdata->rxb); + +/* Error, if 1 byte is not received */ +if (retval !=1 ) { +printk (KERN_ERR +"%s: wrong rcvd byte count (%d)\n" , + drvdata->serio.name, retval); + } + c = drvdata->rxb; +serio_interrupt (&drvdata->serio, c, drvdata->dfl); + drvdata->dfl =0 ; + } + +if (intr_sr &XPS2_IPIXR_TX_ACK ) { + +/* Disable the TX interrupts after the transmission is +* complete */ + ier =in_be32 (drvdata->base_address +XPS2_IPIER_OFFSET ); + ier &= (~(XPS2_IPIXR_TX_ACK &XPS2_IPIXR_ALL )); +out_be32 (drvdata->base_address +XPS2_IPIER_OFFSET , ier); + drvdata->dfl =0 ; + } + +return IRQ_HANDLED ; +} + +/*******************/ +/* serio callbacks */ +/*******************/ + +/* +* sxps2_write() sends a byte out through the PS/2 interface.
drivers/input/serio/xilinx_ps2.c line 118
Quoted 10 lines
drivers/input/serio/xilinx_ps2.c new file +10
-0+* +* The sole purpose of drvdata->tx_end is to prevent the driver +* from locking up in the do {} while; loop when nothing is connected +* to the given PS/2 port. That's why we do not try to recover +* from the transmission failure. +* drvdata->tx_end needs not to be initialized to some "far in the +* future" value, as the very first attempt to xps2_send() a byte +* is always successful, and drvdata->tx_end will be set to a proper +* value at that moment - before the 1st use in the comparison. +*/
Good comment block.
nitpick: can you reformat the comment blocks to be in kerneldoc format? That will allow the automatic document generation tools to parse it.
see: Documentation/kernel-doc-nano-HOWTO.txt
Quoted 117 lines
drivers/input/serio/xilinx_ps2.c new file +117
-0+static int sxps2_write (struct serio *pserio,unsigned char c) +{ +struct xps2data *drvdata = pserio->port_data; +unsigned long flags; +int retval; + +do { +spin_lock_irqsave (&drvdata->lock, flags); + retval =xps2_send (drvdata, &c); +spin_unlock_irqrestore (&drvdata->lock, flags); + +if (retval ==1 ) { + drvdata->tx_end = jiffies +HZ ; +return 0 ;/* success */ + } + }while (!time_after (jiffies, drvdata->tx_end)); + +return 1 ;/* transmission is frozen */ +} + +/* +* sxps2_open() is called when a port is open by the higher layer. +*/ +static int sxps2_open (struct serio *pserio) +{ +struct xps2data *drvdata = pserio->port_data; +int retval; + + retval =request_irq (drvdata->irq, &xps2_interrupt,0 , +DRIVER_NAME , drvdata); +if (retval) { +printk (KERN_ERR +"%s: Couldn't allocate interrupt %d\n" , + drvdata->serio.name, drvdata->irq); +return retval; + } + +/* start reception by enabling the interrupts */ +out_be32 (drvdata->base_address +XPS2_GIER_OFFSET ,XPS2_GIER_GIE_MASK ); +out_be32 (drvdata->base_address +XPS2_IPIER_OFFSET ,XPS2_IPIXR_RX_ALL ); + (void )xps2_recv (drvdata, &drvdata->rxb); + +return 0 ;/* success */ +} + +/* +* sxps2_close() frees the interrupt. +*/ +static void sxps2_close (struct serio *pserio) +{ +struct xps2data *drvdata = pserio->port_data; + +/* Disable the PS2 interrupts */ +out_be32 (drvdata->base_address +XPS2_GIER_OFFSET ,0x00 ); +out_be32 (drvdata->base_address +XPS2_IPIER_OFFSET ,0x00 ); +free_irq (drvdata->irq, drvdata); +} + +/*************************/ +/* XPS PS/2 driver calls */ +/*************************/ + +/* +* xps2_initialize() initializes the Xilinx PS/2 device. +*/ +static int xps2_initialize (struct xps2data *drvdata) +{ +/* Disable all the interrupts just in case */ +out_be32 (drvdata->base_address +XPS2_IPIER_OFFSET ,0 ); + +/* Reset the PS2 device and abort any current transaction, to make sure +* we have the PS2 in a good state */ +out_be32 (drvdata->base_address +XPS2_SRST_OFFSET ,XPS2_SRST_RESET ); + +return 0 ; +} + +/* +* xps2_send() sends the specified byte of data to the PS/2 port in interrupt +* mode. +*/ +static u8 xps2_send (struct xps2data *drvdata,u8 *byte) +{ +u32 sr; +u32 ier; +u8 retval =0 ; + +/* Enter a critical region by disabling the PS/2 transmit interrupts to +* allow this call to stop a previous operation that may be interrupt +* driven. Only stop the transmit interrupt since this critical region +* is not really exited in the normal manner */ + ier =in_be32 (drvdata->base_address +XPS2_IPIER_OFFSET ); + ier &= (~(XPS2_IPIXR_TX_ALL &XPS2_IPIXR_ALL )); +out_be32 (drvdata->base_address +XPS2_IPIER_OFFSET , ier); + +/* If the PS/2 transmitter is empty send a byte of data */ + sr =in_be32 (drvdata->base_address +XPS2_STATUS_OFFSET ); +if ((sr &XPS2_STATUS_TX_FULL ) ==0 ) { +out_be32 (drvdata->base_address +XPS2_TX_DATA_OFFSET , *byte); + retval =1 ; + } + +/* Enable the TX interrupts to track the status of the transmission */ + ier =in_be32 (drvdata->base_address +XPS2_IPIER_OFFSET ); + ier |= ((XPS2_IPIXR_TX_ALL |XPS2_IPIXR_WDT_TOUT )); +out_be32 (drvdata->base_address +XPS2_IPIER_OFFSET , ier); + +return retval;/* no. of bytes sent */ +} + +/* +* xps2_recv() will attempt to receive a byte of data from the PS/2 port. +*/ +static u8 xps2_recv (struct xps2data *drvdata,u8 *byte) +{ +u32 sr; +u8 retval =0 ;
drivers/input/serio/xilinx_ps2.c line 245
Quoted 10 lines
drivers/input/serio/xilinx_ps2.c new file +10
-0+ +/* If there is data available in the PS/2 receiver, read it */ + sr =in_be32 (drvdata->base_address +XPS2_STATUS_OFFSET ); +if (sr &XPS2_STATUS_RX_FULL ) { + *byte =in_be32 (drvdata->base_address +XPS2_RX_DATA_OFFSET ); + retval =1 ; + } + +return retval;/* no. of bytes received */ +}
Since xps2_recv() and xps2_send() are used by the sxps2_* routines and by the irq handler, they should be moved to about them in this file.
drivers/input/serio/xilinx_ps2.c line 249
Quoted 4 lines
drivers/input/serio/xilinx_ps2.c new file +4
-0+ +/******************************/ +/* The platform device driver */ +/******************************/
You can drop the platform driver bindings for inclusion in mainline.
<snip>
drivers/input/serio/xilinx_ps2.c line 387
Quoted 6 lines
drivers/input/serio/xilinx_ps2.c new file +6
-0+static struct device_driver xps2_driver = { + .name =DRIVER_NAME , + .bus = &platform_bus_type, + .probe = xps2_probe, + .remove = xps2_remove +};
This is platform bus stuff that will disappear anyway, but I'm going to make a comment here regardless. When registering a platform bus device driver, you should use 'struct platform_driver' instead of 'struct device_driver', and it should be registered with platform_driver_register().
Quoted 17 lines
new file mode 100644
index 0000000..4db73cadrivers/input/serio/xilinx_ps2.h new file +12
-0@@ -0,0 +1,97 @@ +/***************************************************************************** +* +* Author: Xilinx, Inc. +* +* This program is free software; you can redistribute it and/or modify it +* under the terms of the GNU General Public License as published by the +* Free Software Foundation; either version 2 of the License, or (at your +* option) any later version. +* +* XILINX IS PROVIDING THIS DESIGN, CODE, OR INFORMATION "AS IS" +* AS A COURTESY TO YOU, SOLELY FOR USE IN DEVELOPING PROGRAMS AND +* SOLUTIONS FOR XILINX DEVICES. BY PROVIDING THIS DESIGN, CODE,
drivers/input/serio/xilinx_ps2.h line 22
Quoted 10 lines
drivers/input/serio/xilinx_ps2.h new file +10
-0+* OR INFORMATION AS ONE POSSIBLE IMPLEMENTATION OF THIS FEATURE, +* APPLICATION OR STANDARD, XILINX IS MAKING NO REPRESENTATION +* THAT THIS IMPLEMENTATION IS FREE FROM ANY CLAIMS OF INFRINGEMENT, +* AND YOU ARE RESPONSIBLE FOR OBTAINING ANY RIGHTS YOU MAY REQUIRE +* FOR YOUR IMPLEMENTATION. XILINX EXPRESSLY DISCLAIMS ANY +* WARRANTY WHATSOEVER WITH RESPECT TO THE ADEQUACY OF THE +* IMPLEMENTATION, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OR +* REPRESENTATIONS THAT THIS IMPLEMENTATION IS FREE FROM CLAIMS OF +* INFRINGEMENT, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +* FOR A PARTICULAR PURPOSE.
Please drop this.
<snip>
drivers/input/serio/xilinx_ps2.h line 94
Quoted 6 lines
drivers/input/serio/xilinx_ps2.h new file +6
-0+ +static u8 xps2_send (struct xps2data *drvdata,u8 *buffer_ptr); +static u8 xps2_recv (struct xps2data *drvdata,u8 *buffer_ptr); +static int xps2_initialize (struct xps2data *drvdata); +static int xps2_setup (struct device *dev,int id,struct resource *regs_res, +struct resource *irq_res);
These can be removed by reorganizing the .c file so that callees are always above the caller.
Nice driver.
Cheers,
g.
Dmitry Torokhov
maintainerHi Grant, John,
Quoted 10 lines · Grant Likely
drivers/input/serio/Kconfig config SERIO_RAW · line 197
Quoted 5 lines · John Linn
drivers/input/serio/Kconfig +5
-0+config SERIO_XILINX_XPS_PS2 + tristate "Xilinx XPS PS/2 Controller Support" + help + This driver supports XPS PS/2 IP from Xilinx EDK. +Consider moving this block to somewhere in the middle of the file to reduce the possibility of merge conflicts.
I can take care of that, no worries.
Quoted 13 lines
Quoted 4 lines
+ *
+ * (c) 2005 MontaVista Software, Inc.
+ * (c) 2008 Xilinx Inc.
+ *Quoted 8 lines
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 675 Mass Ave, Cambridge, MA 02139, USA.
Quoted 3 lines
These two paragraphs are redundant. Being in the Linux source tree implies that it is GPL licensed. You can remove them.
I prefer having the statement in right in the code actually. While being the in kernel implies that the code is GPLv2 compatible it could be dual-licensed or GPLv2 only. This removes any doubt as to what license is used on this particular piece of code.
Quoted 67 lines
Quoted 5 lines
+ */
drivers/input/serio/xilinx_ps2.c new file +4
-0+ + +#include <linux/module.h> +#include <linux/serio.h> drivers/input/serio/xilinx_ps2.c line 34
Quoted 10 lines
drivers/input/serio/xilinx_ps2.c new file +10
-0+#include <linux/interrupt.h> +#include <linux/errno.h> +#include <linux/init.h> +#include <linux/list.h> +#include <asm/io.h> + +#ifdef CONFIG_OF /* For open firmware */ +#include <linux/of_device.h> +#include <linux/of_platform.h> +#endif /* CONFIG_OF */ This is a given for mainline since
arch/ppcwill not exist in 2.6.27Review
Quoted 2 lines
(quoted diff) +2
-0+ +#include "xilinx_ps2.h"This header can simple be rolled into this .c file because the driver no longer has multiple .c files.
drivers/input/serio/xilinx_ps2.c line 42
Quoted 3 lines
drivers/input/serio/xilinx_ps2.c new file +3
-0+#define DRIVER_DESCRIPTION "Xilinx XPS PS/2 driver" +#define XPS2_NAME_DESC "Xilinx XPS PS/2 Port #%d" +#define XPS2_PHYS_DESC "xilinxps2/serio%d"These strings are only used in 1 place each, no need to use a #define
drivers/input/serio/xilinx_ps2.c line 45
Quoted 3 lines
drivers/input/serio/xilinx_ps2.c new file +3
-0+ + +static DECLARE_MUTEX (cfg_sem);This mutex should be part of the driver private data structure
Quoted 30 lines
drivers/input/serio/xilinx_ps2.c new file +30
-0+ +/*********************/ +/* Interrupt handler */ +/*********************/ +static irqreturn_t xps2_interrupt (int irq,void *dev_id) +{ +struct xps2data *drvdata = (struct xps2data *)dev_id; +u32 intr_sr; +u32 ier; +u8 c; +u8 retval; + +/* Get the PS/2 interrupts and clear them */ + intr_sr =in_be32 (drvdata->base_address +XPS2_IPISR_OFFSET ); +out_be32 (drvdata->base_address +XPS2_IPISR_OFFSET , intr_sr); + +/* Check which interrupt is active */ +if (intr_sr &XPS2_IPIXR_RX_OVF ) { +printk (KERN_ERR "%s: receive overrun error\n" , + drvdata->serio.name); + } + +if (intr_sr &XPS2_IPIXR_RX_ERR ) { + drvdata->dfl |=SERIO_PARITY ; + } + +if (intr_sr & (XPS2_IPIXR_TX_NOACK |XPS2_IPIXR_WDT_TOUT )) { + drvdata->dfl |=SERIO_TIMEOUT ; + } +
Quoted 8 lines
drivers/input/serio/xilinx_ps2.c line 83
Quoted 8 lines
drivers/input/serio/xilinx_ps2.c new file +8
-0+if (intr_sr &XPS2_IPIXR_RX_FULL ) { + retval =xps2_recv (drvdata, &drvdata->rxb); + +/* Error, if 1 byte is not received */ +if (retval !=1 ) { +printk (KERN_ERR +"%s: wrong rcvd byte count (%d)\n" , + drvdata->serio.name, retval);
Don't you want to bail out here? Otherwise you will feed garbage to serio_interrupt() I think.
Quoted 38 lines
Quoted 25 lines
drivers/input/serio/xilinx_ps2.c new file +25
-0+ } + c = drvdata->rxb; +serio_interrupt (&drvdata->serio, c, drvdata->dfl); + drvdata->dfl =0 ; + } + +if (intr_sr &XPS2_IPIXR_TX_ACK ) { + +/* Disable the TX interrupts after the transmission is +* complete */ + ier =in_be32 (drvdata->base_address +XPS2_IPIER_OFFSET ); + ier &= (~(XPS2_IPIXR_TX_ACK &XPS2_IPIXR_ALL )); +out_be32 (drvdata->base_address +XPS2_IPIER_OFFSET , ier); + drvdata->dfl =0 ; + } + +return IRQ_HANDLED ; +} + +/*******************/ +/* serio callbacks */ +/*******************/ + +/* +* sxps2_write() sends a byte out through the PS/2 interface. drivers/input/serio/xilinx_ps2.c line 118
Quoted 10 lines
drivers/input/serio/xilinx_ps2.c new file +10
-0+* +* The sole purpose of drvdata->tx_end is to prevent the driver +* from locking up in the do {} while; loop when nothing is connected +* to the given PS/2 port. That's why we do not try to recover +* from the transmission failure. +* drvdata->tx_end needs not to be initialized to some "far in the +* future" value, as the very first attempt to xps2_send() a byte +* is always successful, and drvdata->tx_end will be set to a proper +* value at that moment - before the 1st use in the comparison. +*/ Good comment block.
Quoted 4 lines
nitpick: can you reformat the comment blocks to be in kerneldoc format? That will allow the automatic document generation tools to parse it.
see:
Documentation/kernel-doc-nano-HOWTO.txt
This is an internal function so its not going to be exposed in kerneldoc though.
Quoted 17 lines
Quoted 7 lines
drivers/input/serio/xilinx_ps2.c new file +6
-0+static int sxps2_write (struct serio *pserio,unsigned char c) +{ +struct xps2data *drvdata = pserio->port_data; +unsigned long flags; +int retval; +drivers/input/serio/xilinx_ps2.c line 134
Quoted 10 lines
drivers/input/serio/xilinx_ps2.c new file +10
-0+do { +spin_lock_irqsave (&drvdata->lock, flags); + retval =xps2_send (drvdata, &c); +spin_unlock_irqrestore (&drvdata->lock, flags); + +if (retval ==1 ) { + drvdata->tx_end = jiffies +HZ ; +return 0 ;/* success */ + } + }while (!time_after (jiffies, drvdata->tx_end));
The logic escapes me... Let's say you send a byte and time when jiffies were 10000 and now it is time 20000 and we try to send another byte. Our first attempt fails and with time fence 11000 (HZ=1000) we bail out of sxps2_write() after the very first unsiccessful attempt. Is this what you intended?
Quoted 2 lines
Review
Quoted 2 lines
(quoted diff) +2
-0+ + return 1; /* transmission is frozen */
It is better to return a negative on error, even if you don't report actual -EXXXX error code.
Signature · 1 line
Dmitry
Quoted 4 lines · Dmitry Torokhov
Hi Grant, John,
Quoted 1 line · Grant Likely
On Mon, Jun 30, 2008 at 07:24:48AM -0700, John Linn wrote:
<snip>
Quoted 15 lines
Quoted 15 lines
Quoted 4 lines
+/*
+ *sxps2_write()sends a byte out through the PS/2 interface.
+ *
+ * The sole purpose ofdrvdata->tx_endis to prevent the driverQuoted 8 lines
+ * from locking up in the do {} while; loop when nothing is connected
+ * to the given PS/2 port. That's why we do not try to recover
+ * from the transmission failure.
+ *drvdata->tx_endneeds not to be initialized to some "far in the
+ * future" value, as the very first attempt toxps2_send()a byte
+ * is always successful, anddrvdata->tx_endwill be set to a proper
+ * value at that moment - before the 1st use in the comparison.
+ */Good comment block.
Quoted 7 lines
Quoted 4 lines
nitpick: can you reformat the comment blocks to be in kerneldoc format? That will allow the automatic document generation tools to parse it.
see:
Documentation/kernel-doc-nano-HOWTO.txtThis is an internal function so its not going to be exposed in kerneldoc though.
Just to complete this discussion, quoting from kernel-doc-nano-HOWTO.txt:
"We also recommend providing kernel-doc formatted documentation for private (file "static") routines, for consistency of kernel source code layout. But this is lower priority and at the discretion of the MAINTAINER of that kernel source file."
but it's just a nitpick, and I'll say nothing more about it.
g.
Thanks Peter, those make sense. We'll incorporate those comments.
-----Original Message-----
From: Peter Korsgaard [mailto:[email protected]] On Behalf Of Peter Korsgaard
Sent: Monday, June 30, 2008 8:45 AM
To: John Linn
Cc: [email protected]; Sadanand Mutyala
Subject: Re: [PATCH] powerpc: Xilinx: PS2: Added new XPS PS2 driver
Quoted 6 lines
Quoted 4 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
"John" =3D=3D John Linn <[email protected]> writes:
Added a new driver for Xilinx XPS PS2 IP. This driver is a flat driver to better match the Linux driver pattern.
This should probably go to the linux-input@ list as well.
Agreed, done.
Quoted 7 lines
Quoted 7 lines
Signed-off-by Sadanand <[email protected]>Signed-off-by John Linn <[email protected]>--- drivers/input/serio/Kconfig | 5 + drivers/input/serio/Makefile | 1 + drivers/input/serio/xilinx_ps2.c | 464
++++++++++++++++++++++++++++++++++++++
Quoted 6 lines
Review
Quoted 6 lines
drivers/input/serio/xilinx_ps2.h | 97 ++++++++ 4 files changed, 567 insertions(+), 0 deletions(-) create mode 100644 drivers/input/serio/xilinx_ps2.c create mode 100644 drivers/input/serio/xilinx_ps2.h(quoted diff) +0
-0
b/drivers/input/serio/Kconfig
Quoted 8 lines
drivers/input/serio/Kconfig config SERIO_RAW · line 191
Quoted 6 lines
index ec4b661..0e62b39 100644
drivers/input/serio/Kconfig +0
-0@@ -190,4 +190,9 @@ config SERIO_RAW To compile this driver as a module, choose M here: the module will be called serio_raw.=
Quoted 7 lines
Review
Quoted 7 lines
drivers/input/serio/Kconfig +5
-0+config SERIO_XILINX_XPS_PS2 + tristate "Xilinx XPS PS/2 Controller Support" + help + This driver supports XPS PS/2 IP from Xilinx EDK. + endif(quoted diff) +0
-0
b/drivers/input/serio/Makefile
Quoted 9 lines
Review
Quoted 9 lines
index 38b8868..9b6c813 100644
drivers/input/serio/Makefile +1
-0@@ -21,3 +21,4 @@ obj-$(CONFIG_SERIO_PCIPS2) +=3D pcips2.o obj-$(CONFIG_SERIO_MACEPS2) +=3D maceps2.o obj-$(CONFIG_SERIO_LIBPS2) +=3D libps2.o obj-$(CONFIG_SERIO_RAW) +=3D serio_raw.o +obj-$(CONFIG_SERIO_XILINX_XPS_PS2) +=3D xilinx_ps2.o(quoted diff) +0
-0
b/drivers/input/serio/xilinx_ps2.c
Quoted 10 lines
Quoted 10 lines
new file mode 100644
index 0000000..670d47fdrivers/input/serio/xilinx_ps2.c new file +5
-0@@ -0,0 +1,464 @@ +/* +* xilinx_ps2.c +* +* Xilinx PS/2 driver to interface PS/2 component to Linux +*
Quoted 9 lines
drivers/input/serio/xilinx_ps2.c line 11
Quoted 6 lines
drivers/input/serio/xilinx_ps2.c new file +6
-0+* Author: MontaVista Software, Inc. +* [email protected] +* +* (c) 2005 MontaVista Software, Inc. +* (c) 2008 Xilinx Inc. +* Is the montavista stuff still valid?
We derived the driver from MontaVista code is the reason we left it in. Since a significant part of the code was derived, I think we defaulted to leave it in.
Quoted 1 line
drivers/input/serio/xilinx_ps2.c line 12
Quoted 1 line
drivers/input/serio/xilinx_ps2.c new file +1
-0+* This program is free software; you can redistribute it and/or
modify it
Quoted 1 line
drivers/input/serio/xilinx_ps2.c line 13
Quoted 1 line
drivers/input/serio/xilinx_ps2.c new file +1
-0+* under the terms of the GNU General Public License as published
by the
Quoted 1 line
drivers/input/serio/xilinx_ps2.c line 14
Quoted 1 line
drivers/input/serio/xilinx_ps2.c new file +1
-0+* Free Software Foundation; either version 2 of the License, or
(at your
Quoted 3 lines
drivers/input/serio/xilinx_ps2.c
Quoted 3 lines
drivers/input/serio/xilinx_ps2.c new file +3
-0+* option) any later version. +* +* You should have received a copy of the GNU General Public
License along
Quoted 1 line
drivers/input/serio/xilinx_ps2.c line 18
Quoted 1 line
drivers/input/serio/xilinx_ps2.c new file +1
-0+* with this program; if not, write to the Free Software
Foundation, Inc.,
Quoted 5 lines
Quoted 5 lines
drivers/input/serio/xilinx_ps2.c new file +5
-0+* 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + + +#include <linux/module.h>
Quoted 9 lines
drivers/input/serio/xilinx_ps2.c line 29
Quoted 6 lines
drivers/input/serio/xilinx_ps2.c new file +6
-0+#include <linux/serio.h> +#include <linux/interrupt.h> +#include <linux/errno.h> +#include <linux/init.h> +#include <linux/list.h> +#include <asm/io.h>
linux/io.hplease.
Done in v2.
Quoted 6 lines
drivers/input/serio/xilinx_ps2.c line 31
Quoted 2 lines
drivers/input/serio/xilinx_ps2.c new file +2
-0+ +#ifdef CONFIG_OF /* For open firmware */ Why support !CONFIG_OF? =
Agreed, we just got in the habit.
Quoted 8 lines
drivers/input/serio/xilinx_ps2.c line 36
Quoted 5 lines
drivers/input/serio/xilinx_ps2.c new file +5
-0+#include <linux/of_device.h> +#include <linux/of_platform.h> +#endif /* CONFIG_OF */ + +#include "xilinx_ps2.h" Why the seperate header? You're the only user of it, right?
That's true, can be incorporated into the c file.
Quoted 9 lines
drivers/input/serio/xilinx_ps2.c line 42
Quoted 6 lines
drivers/input/serio/xilinx_ps2.c new file +6
-0+ +#define DRIVER_NAME "xilinx_ps2" +#define DRIVER_DESCRIPTION "Xilinx XPS PS/2 driver" + +#define XPS2_NAME_DESC "Xilinx XPS PS/2 Port #%d" +#define XPS2_PHYS_DESC "xilinxps2/serio%d"Why have defines to stuff only used once?
Agreed, out of habit.
Quoted 11 lines
...
drivers/input/serio/xilinx_ps2.c line 251
Quoted 6 lines
drivers/input/serio/xilinx_ps2.c new file +6
-0+ +/******************************/ +/* The platform device driver */ +/******************************/ + +static int xps2_probe (struct device *dev)
__devinitplease.
Agreed.
Quoted 4 lines
drivers/input/serio/xilinx_ps2.c
Quoted 4 lines
drivers/input/serio/xilinx_ps2.c new file +4
-0+{ + struct platform_device *pdev =3D to_platform_device(dev); + + struct resource *irq_res =3D NULL; /* Interrupt resources
*/
Quoted 15 lines
Quoted 12 lines
drivers/input/serio/xilinx_ps2.c new file +12
-0+ struct resource *regs_res =3D NULL; /* IO mem resources */ + +if (!dev) { +dev_err (dev,"Probe called with NULL param\n" ); +return -EINVAL ; + } + +/* Find irq number, map the control registers in */ + irq_res =3D platform_get_resource(pdev, IORESOURCE_IRQ, 0); + regs_res =3D platform_get_resource(pdev, IORESOURCE_MEM, 0); +return xps2_setup (dev, pdev->id, regs_res, irq_res); +}...
Quoted 3 lines
drivers/input/serio/xilinx_ps2.c
Quoted 3 lines
drivers/input/serio/xilinx_ps2.c new file +3
-0+ +/* +* xps2_remove() dissociates the driver with the Xilinx PS/2
device.
Quoted 5 lines
Quoted 2 lines
+ */
+static intxps2_remove(struct device *dev)
__devexitplease.
Agreed.
Quoted 15 lines
Quoted 15 lines
drivers/input/serio/xilinx_ps2.c new file +15
-0+{ +struct xps2data *drvdata; + +if (!dev) +return -EINVAL ; + + drvdata =3D (struct xps2data *)dev_get_drvdata(dev); + + serio_unregister_port(&drvdata->serio); + + iounmap(drvdata->base_address); + + release_mem_region(drvdata->phys_addr, drvdata->remap_size); + +kfree (drvdata);
Quoted 9 lines
drivers/input/serio/xilinx_ps2.c
Quoted 6 lines
drivers/input/serio/xilinx_ps2.c new file +6
-0+dev_set_drvdata (dev,NULL ); + +return 0 ;/* success */ +} + +static struct device_driver xps2_driver =3D {Please use a real struct
platform_driverinstead.
Agreed, this will go away I think.
Quoted 7 lines
drivers/input/serio/xilinx_ps2.c
Quoted 6 lines
drivers/input/serio/xilinx_ps2.c new file +6
-0+ .name =3D DRIVER_NAME, + .bus =3D &platform_bus_type, + .probe =3D xps2_probe, + .remove =3D xps2_remove +}; +
-- =
Bye, Peter Korsgaard
This email and any attachments are intended for the sole use of the named r= ecipient(s) and contain(s) confidential information that may be proprietary= , privileged or copyrighted under applicable law. If you are not the intend= ed recipient, do not read, copy, or forward this email message or any attac= hments. Delete this email message and any attachments immediately.
Thanks Grant. Sounds like there's a few things that not everyone does the same based on comments from others.
In general, all pretty easy changes that in general make sense.
Thanks,
John
Quoted 20 lines · John Linn
Quoted 5 lines
Added a new driver for Xilinx XPS PS2 IP. This driver is a flat driver to better match the Linux driver pattern.
Signed-off-by Sadanand <[email protected]>Signed-off-by John Linn <[email protected]>I don't know much about the serio conventions, but I can make some general comments...
from
MAINTAINERS:INPUT (KEYBOARD, MOUSE, JOYSTICK, TOUCHSCREEN) DRIVERS
P: Dmitry Torokhov
M: [email protected]
M: [email protected]
L: [email protected]
T: git kernel.org:/pub/scm/linux/kernel/git/dtor/input.git
S: Maintained
Quoted 3 lines
You need to cc: the linux-input mailing list and Dimitry when you post the next version of this driver.
Makes sense, gotta get into the habit of that.
Quoted 4 lines
Quoted 4 lines
--- drivers/input/serio/Kconfig | 5 + drivers/input/serio/Makefile | 1 + drivers/input/serio/xilinx_ps2.c | 464
++++++++++++++++++++++++++++++++++++++
Quoted 6 lines
Review
Quoted 6 lines
drivers/input/serio/xilinx_ps2.h | 97 ++++++++ 4 files changed, 567 insertions(+), 0 deletions(-) create mode 100644 drivers/input/serio/xilinx_ps2.c create mode 100644 drivers/input/serio/xilinx_ps2.h(quoted diff) +0
-0
b/drivers/input/serio/Kconfig
Quoted 7 lines
Quoted 7 lines
index ec4b661..0e62b39 100644
drivers/input/serio/Kconfig +0
-0@@ -190,4 +190,9 @@ config SERIO_RAW To compile this driver as a module, choose M here: the module will be called serio_raw.
Quoted 9 lines
drivers/input/serio/Kconfig config SERIO_RAW · line 197
Quoted 5 lines
drivers/input/serio/Kconfig +5
-0+config SERIO_XILINX_XPS_PS2 + tristate "Xilinx XPS PS/2 Controller Support" + help + This driver supports XPS PS/2 IP from Xilinx EDK. +Consider moving this block to somewhere in the middle of the file to reduce the possibility of merge conflicts.
Sounds like this is not needed by Dmitry, but maybe it's a better habit to get into.
Quoted 2 lines
Review
Quoted 2 lines
drivers/input/serio/Kconfig +0
-0endif(quoted diff) +0
-0
b/drivers/input/serio/Makefile
Quoted 11 lines
drivers/input/serio/Makefile obj-$(CONFIG_SERIO_PCIPS2) += pcips2.o · line 24
Quoted 8 lines
index 38b8868..9b6c813 100644
drivers/input/serio/Makefile +1
-0@@ -21,3 +21,4 @@ obj-$(CONFIG_SERIO_PCIPS2) += pcips2.o obj-$(CONFIG_SERIO_MACEPS2) += maceps2.o obj-$(CONFIG_SERIO_LIBPS2) += libps2.o obj-$(CONFIG_SERIO_RAW) += serio_raw.o +obj-$(CONFIG_SERIO_XILINX_XPS_PS2) += xilinx_ps2.oDitto.
Review
Quoted 1 line
(quoted diff) +0
-0
b/drivers/input/serio/xilinx_ps2.c
Quoted 9 lines
drivers/input/serio/xilinx_ps2.c line 2
Quoted 7 lines
new file mode 100644
index 0000000..670d47fdrivers/input/serio/xilinx_ps2.c new file +2
-0@@ -0,0 +1,464 @@ +/* +* xilinx_ps2.c Don't put the .c filename in the header block.
OK.
Quoted 9 lines
drivers/input/serio/xilinx_ps2.c line 7
Quoted 6 lines
drivers/input/serio/xilinx_ps2.c new file +5
-0+* +* Xilinx PS/2 driver to interface PS/2 component to Linux +* +* Author: MontaVista Software, Inc. +* [email protected] Is this true anymore?
Not clear to me since we derived the code from an existing driver. Can be removed.
Quoted 5 lines
drivers/input/serio/xilinx_ps2.c
Quoted 5 lines
drivers/input/serio/xilinx_ps2.c new file +5
-0+* +* (c) 2005 MontaVista Software, Inc. +* (c) 2008 Xilinx Inc. +* +* This program is free software; you can redistribute it and/or
modify it
Quoted 1 line
drivers/input/serio/xilinx_ps2.c line 13
Quoted 1 line
drivers/input/serio/xilinx_ps2.c new file +1
-0+* under the terms of the GNU General Public License as published by
the
Quoted 1 line
drivers/input/serio/xilinx_ps2.c line 14
Quoted 1 line
drivers/input/serio/xilinx_ps2.c new file +1
-0+* Free Software Foundation; either version 2 of the License, or (at
your
Quoted 3 lines
drivers/input/serio/xilinx_ps2.c
Quoted 3 lines
drivers/input/serio/xilinx_ps2.c new file +3
-0+* option) any later version. +* +* You should have received a copy of the GNU General Public License
along
Quoted 1 line
drivers/input/serio/xilinx_ps2.c line 18
Quoted 1 line
drivers/input/serio/xilinx_ps2.c new file +1
-0+* with this program; if not, write to the Free Software Foundation,
Inc.,
Quoted 5 lines
drivers/input/serio/xilinx_ps2.c line 19
Quoted 1 line
drivers/input/serio/xilinx_ps2.c new file +1
-0+* 675 Mass Ave, Cambridge, MA 02139, USA. These two paragraphs are redundant. Being in the Linux source tree implies that it is GPL licensed. You can remove them.
Sounds like there's not consistency as Dmitry said it can be left. Fine either way.
What is the best habit to get into that will satisfy the majority of the crowd?
Quoted 9 lines
Quoted 9 lines
drivers/input/serio/xilinx_ps2.c new file +9
-0+*/ + + +#include <linux/module.h> +#include <linux/serio.h> +#include <linux/interrupt.h> +#include <linux/errno.h> +#include <linux/init.h> +#include <linux/list.h>
Quoted 9 lines
drivers/input/serio/xilinx_ps2.c line 34
Quoted 6 lines
drivers/input/serio/xilinx_ps2.c new file +6
-0+#include <asm/io.h> + +#ifdef CONFIG_OF /* For open firmware */ +#include <linux/of_device.h> +#include <linux/of_platform.h> +#endif /* CONFIG_OF */ This is a given for mainline since
arch/ppcwill not exist in 2.6.27
Agreed, we'll remove.
Quoted 4 lines
drivers/input/serio/xilinx_ps2.c line 36
Quoted 2 lines
drivers/input/serio/xilinx_ps2.c new file +2
-0+ +#include "xilinx_ps2.h" This header can simple be rolled into this .c file because the driver
no
Quoted 2 lines
longer has multiple .c files.
Agreed.
Quoted 7 lines
drivers/input/serio/xilinx_ps2.c line 42
Quoted 4 lines
drivers/input/serio/xilinx_ps2.c new file +3
-0+#define DRIVER_DESCRIPTION "Xilinx XPS PS/2 driver" +#define XPS2_NAME_DESC "Xilinx XPS PS/2 Port #%d" +#define XPS2_PHYS_DESC "xilinxps2/serio%d"These strings are only used in 1 place each, no need to use a #define
Agreed.
Quoted 6 lines
drivers/input/serio/xilinx_ps2.c line 45
Quoted 3 lines
drivers/input/serio/xilinx_ps2.c new file +3
-0+ + +static DECLARE_MUTEX (cfg_sem);This mutex should be part of the driver private data structure
OK. I assume just trying to keep all the driver private data together.
Quoted 41 lines
Quoted 41 lines
drivers/input/serio/xilinx_ps2.c new file +41
-0+ +/*********************/ +/* Interrupt handler */ +/*********************/ +static irqreturn_t xps2_interrupt (int irq,void *dev_id) +{ +struct xps2data *drvdata = (struct xps2data *)dev_id; +u32 intr_sr; +u32 ier; +u8 c; +u8 retval; + +/* Get the PS/2 interrupts and clear them */ + intr_sr =in_be32 (drvdata->base_address +XPS2_IPISR_OFFSET ); +out_be32 (drvdata->base_address +XPS2_IPISR_OFFSET , intr_sr); + +/* Check which interrupt is active */ +if (intr_sr &XPS2_IPIXR_RX_OVF ) { +printk (KERN_ERR "%s: receive overrun error\n" , + drvdata->serio.name); + } + +if (intr_sr &XPS2_IPIXR_RX_ERR ) { + drvdata->dfl |=SERIO_PARITY ; + } + +if (intr_sr & (XPS2_IPIXR_TX_NOACK |XPS2_IPIXR_WDT_TOUT )) { + drvdata->dfl |=SERIO_TIMEOUT ; + } + +if (intr_sr &XPS2_IPIXR_RX_FULL ) { + retval =xps2_recv (drvdata, &drvdata->rxb); + +/* Error, if 1 byte is not received */ +if (retval !=1 ) { +printk (KERN_ERR +"%s: wrong rcvd byte count (%d)\n" , + drvdata->serio.name, retval); + } + c = drvdata->rxb; +serio_interrupt (&drvdata->serio, c, drvdata->dfl);
Quoted 8 lines
drivers/input/serio/xilinx_ps2.c
Quoted 8 lines
drivers/input/serio/xilinx_ps2.c new file +8
-0+ drvdata->dfl =0 ; + } + +if (intr_sr &XPS2_IPIXR_TX_ACK ) { + +/* Disable the TX interrupts after the transmission is +* complete */ + ier = in_be32(drvdata->base_address +
XPS2_IPIER_OFFSET);
Quoted 2 lines
drivers/input/serio/xilinx_ps2.c line 93
Quoted 2 lines
drivers/input/serio/xilinx_ps2.c new file +2
-0+ ier &= (~(XPS2_IPIXR_TX_ACK &XPS2_IPIXR_ALL )); + out_be32(drvdata->base_address + XPS2_IPIER_OFFSET,
ier);
Quoted 7 lines
Quoted 7 lines
drivers/input/serio/xilinx_ps2.c new file +7
-0+ drvdata->dfl =0 ; + } + +return IRQ_HANDLED ; +} + +/*******************/
Quoted 8 lines
drivers/input/serio/xilinx_ps2.c
Quoted 8 lines
drivers/input/serio/xilinx_ps2.c new file +8
-0+/* serio callbacks */ +/*******************/ + +/* +* sxps2_write() sends a byte out through the PS/2 interface. +* +* The sole purpose of drvdata->tx_end is to prevent the driver +* from locking up in the do {} while; loop when nothing is
connected
Quoted 8 lines
drivers/input/serio/xilinx_ps2.c line 118
Quoted 7 lines
drivers/input/serio/xilinx_ps2.c new file +7
-0+* to the given PS/2 port. That's why we do not try to recover +* from the transmission failure. +* drvdata->tx_end needs not to be initialized to some "far in the +* future" value, as the very first attempt to xps2_send() a byte +* is always successful, and drvdata->tx_end will be set to a proper +* value at that moment - before the 1st use in the comparison. +*/
Quoted 6 lines
Good comment block.
nitpick: can you reformat the comment blocks to be in kerneldoc format? That will allow the automatic document generation tools to parse it.
see:
Documentation/kernel-doc-nano-HOWTO.txt
Sounds like it won't matter according to Dmitry,
but maybe it's a good habit to get into anyway.
Quoted 32 lines
Quoted 32 lines
drivers/input/serio/xilinx_ps2.c new file +31
-0+static int sxps2_write (struct serio *pserio,unsigned char c) +{ +struct xps2data *drvdata = pserio->port_data; +unsigned long flags; +int retval; + +do { +spin_lock_irqsave (&drvdata->lock, flags); + retval =xps2_send (drvdata, &c); +spin_unlock_irqrestore (&drvdata->lock, flags); + +if (retval ==1 ) { + drvdata->tx_end = jiffies +HZ ; +return 0 ;/* success */ + } + }while (!time_after (jiffies, drvdata->tx_end)); + +return 1 ;/* transmission is frozen */ +} + +/* +* sxps2_open() is called when a port is open by the higher layer. +*/ +static int sxps2_open (struct serio *pserio) +{ +struct xps2data *drvdata = pserio->port_data; +int retval; + + retval =request_irq (drvdata->irq, &xps2_interrupt,0 , +DRIVER_NAME , drvdata); +if (retval) {
Quoted 8 lines
drivers/input/serio/xilinx_ps2.c
Quoted 8 lines
drivers/input/serio/xilinx_ps2.c new file +8
-0+printk (KERN_ERR +"%s: Couldn't allocate interrupt %d\n" , + drvdata->serio.name, drvdata->irq); +return retval; + } + +/* start reception by enabling the interrupts */ + out_be32(drvdata->base_address + XPS2_GIER_OFFSET,
XPS2_GIER_GIE_MASK);
Quoted 1 line
drivers/input/serio/xilinx_ps2.c line 155
Quoted 1 line
drivers/input/serio/xilinx_ps2.c new file +1
-0+ out_be32(drvdata->base_address + XPS2_IPIER_OFFSET,
XPS2_IPIXR_RX_ALL);
Quoted 23 lines
Quoted 23 lines
drivers/input/serio/xilinx_ps2.c new file +23
-0+ (void )xps2_recv (drvdata, &drvdata->rxb); + +return 0 ;/* success */ +} + +/* +* sxps2_close() frees the interrupt. +*/ +static void sxps2_close (struct serio *pserio) +{ +struct xps2data *drvdata = pserio->port_data; + +/* Disable the PS2 interrupts */ +out_be32 (drvdata->base_address +XPS2_GIER_OFFSET ,0x00 ); +out_be32 (drvdata->base_address +XPS2_IPIER_OFFSET ,0x00 ); +free_irq (drvdata->irq, drvdata); +} + +/*************************/ +/* XPS PS/2 driver calls */ +/*************************/ + +/*
Quoted 8 lines
drivers/input/serio/xilinx_ps2.c
Quoted 8 lines
drivers/input/serio/xilinx_ps2.c new file +8
-0+* xps2_initialize() initializes the Xilinx PS/2 device. +*/ +static int xps2_initialize (struct xps2data *drvdata) +{ +/* Disable all the interrupts just in case */ +out_be32 (drvdata->base_address +XPS2_IPIER_OFFSET ,0 ); + +/* Reset the PS2 device and abort any current transaction, to
make sure
Quoted 2 lines
drivers/input/serio/xilinx_ps2.c line 188
Quoted 2 lines
drivers/input/serio/xilinx_ps2.c new file +2
-0+* we have the PS2 in a good state */ + out_be32(drvdata->base_address + XPS2_SRST_OFFSET,
XPS2_SRST_RESET);
Quoted 6 lines
drivers/input/serio/xilinx_ps2.c
Quoted 6 lines
drivers/input/serio/xilinx_ps2.c new file +6
-0+ +return 0 ; +} + +/* +* xps2_send() sends the specified byte of data to the PS/2 port in
interrupt
Quoted 9 lines
drivers/input/serio/xilinx_ps2.c
Quoted 9 lines
drivers/input/serio/xilinx_ps2.c new file +9
-0+* mode. +*/ +static u8 xps2_send (struct xps2data *drvdata,u8 *byte) +{ +u32 sr; +u32 ier; +u8 retval =0 ; + +/* Enter a critical region by disabling the PS/2 transmit
interrupts to
Quoted 1 line
drivers/input/serio/xilinx_ps2.c line 204
Quoted 1 line
drivers/input/serio/xilinx_ps2.c new file +1
-0+* allow this call to stop a previous operation that may be
interrupt
Quoted 1 line
drivers/input/serio/xilinx_ps2.c line 205
Quoted 1 line
drivers/input/serio/xilinx_ps2.c new file +1
-0+* driven. Only stop the transmit interrupt since this critical
region
Quoted 9 lines
drivers/input/serio/xilinx_ps2.c
Quoted 9 lines
drivers/input/serio/xilinx_ps2.c new file +9
-0+* is not really exited in the normal manner */ + ier =in_be32 (drvdata->base_address +XPS2_IPIER_OFFSET ); + ier &= (~(XPS2_IPIXR_TX_ALL &XPS2_IPIXR_ALL )); +out_be32 (drvdata->base_address +XPS2_IPIER_OFFSET , ier); + +/* If the PS/2 transmitter is empty send a byte of data */ + sr =in_be32 (drvdata->base_address +XPS2_STATUS_OFFSET ); +if ((sr &XPS2_STATUS_TX_FULL ) ==0 ) { + out_be32(drvdata->base_address + XPS2_TX_DATA_OFFSET,
*byte);
Quoted 4 lines
drivers/input/serio/xilinx_ps2.c
Quoted 4 lines
drivers/input/serio/xilinx_ps2.c new file +4
-0+ retval =1 ; + } + +/* Enable the TX interrupts to track the status of the
transmission */
Quoted 9 lines
drivers/input/serio/xilinx_ps2.c
Quoted 9 lines
drivers/input/serio/xilinx_ps2.c new file +9
-0+ ier =in_be32 (drvdata->base_address +XPS2_IPIER_OFFSET ); + ier |= ((XPS2_IPIXR_TX_ALL |XPS2_IPIXR_WDT_TOUT )); +out_be32 (drvdata->base_address +XPS2_IPIER_OFFSET , ier); + +return retval;/* no. of bytes sent */ +} + +/* +* xps2_recv() will attempt to receive a byte of data from the PS/2
port.
Quoted 10 lines
drivers/input/serio/xilinx_ps2.c
Quoted 10 lines
drivers/input/serio/xilinx_ps2.c new file +10
-0+*/ +static u8 xps2_recv (struct xps2data *drvdata,u8 *byte) +{ +u32 sr; +u8 retval =0 ; + +/* If there is data available in the PS/2 receiver, read it */ + sr =in_be32 (drvdata->base_address +XPS2_STATUS_OFFSET ); +if (sr &XPS2_STATUS_RX_FULL ) { + *byte = in_be32(drvdata->base_address +
XPS2_RX_DATA_OFFSET);
Quoted 9 lines
drivers/input/serio/xilinx_ps2.c line 245
Quoted 5 lines
drivers/input/serio/xilinx_ps2.c new file +5
-0+ retval =1 ; + } + +return retval;/* no. of bytes received */ +}Since
xps2_recv()andxps2_send()are used by the sxps2_* routines and by the irq handler, they should be moved to about them in this file.
OK, keeping them close makes maintenance easier I guess.
Quoted 6 lines
drivers/input/serio/xilinx_ps2.c line 249
Quoted 4 lines
drivers/input/serio/xilinx_ps2.c new file +4
-0+ +/******************************/ +/* The platform device driver */ +/******************************/ You can drop the platform driver bindings for inclusion in mainline.
OK.
Quoted 15 lines
<snip>
drivers/input/serio/xilinx_ps2.c line 387
Quoted 6 lines
drivers/input/serio/xilinx_ps2.c new file +6
-0+static struct device_driver xps2_driver = { + .name =DRIVER_NAME , + .bus = &platform_bus_type, + .probe = xps2_probe, + .remove = xps2_remove +};This is platform bus stuff that will disappear anyway, but I'm going to make a comment here regardless. When registering a platform bus device driver, you should use 'struct
platform_driver' instead of 'structdevice_driver', and it should be registered withplatform_driver_register().
OK.
Quoted 6 lines
drivers/input/serio/xilinx_ps2.h
Quoted 6 lines
new file mode 100644
index 0000000..4db73cadrivers/input/serio/xilinx_ps2.h new file +0
-0@@ -0,0 +1,97 @@
+/**********************************************************************
*******
Quoted 4 lines
drivers/input/serio/xilinx_ps2.h
Quoted 4 lines
drivers/input/serio/xilinx_ps2.h new file +4
-0+* +* Author: Xilinx, Inc. +* +* This program is free software; you can redistribute it and/or
modify it
Quoted 1 line
drivers/input/serio/xilinx_ps2.h line 5
Quoted 1 line
drivers/input/serio/xilinx_ps2.h new file +1
-0+* under the terms of the GNU General Public License as
published by the
Quoted 1 line
drivers/input/serio/xilinx_ps2.h line 6
Quoted 1 line
drivers/input/serio/xilinx_ps2.h new file +1
-0+* Free Software Foundation; either version 2 of the License, or
(at your
Quoted 4 lines
drivers/input/serio/xilinx_ps2.h
Quoted 4 lines
drivers/input/serio/xilinx_ps2.h new file +4
-0+* option) any later version. +* +* XILINX IS PROVIDING THIS DESIGN, CODE, OR INFORMATION "AS IS" +* AS A COURTESY TO YOU, SOLELY FOR USE IN DEVELOPING PROGRAMS
AND
Quoted 1 line
drivers/input/serio/xilinx_ps2.h line 11
Quoted 1 line
drivers/input/serio/xilinx_ps2.h new file +1
-0+* SOLUTIONS FOR XILINX DEVICES. BY PROVIDING THIS DESIGN,
CODE,
Quoted 1 line
drivers/input/serio/xilinx_ps2.h line 12
Quoted 1 line
drivers/input/serio/xilinx_ps2.h new file +1
-0+* OR INFORMATION AS ONE POSSIBLE IMPLEMENTATION OF THIS
FEATURE,
Quoted 2 lines
drivers/input/serio/xilinx_ps2.h line 14
Quoted 2 lines
drivers/input/serio/xilinx_ps2.h new file +2
-0+* APPLICATION OR STANDARD, XILINX IS MAKING NO REPRESENTATION +* THAT THIS IMPLEMENTATION IS FREE FROM ANY CLAIMS OF
INFRINGEMENT,
Quoted 1 line
drivers/input/serio/xilinx_ps2.h line 15
Quoted 1 line
drivers/input/serio/xilinx_ps2.h new file +1
-0+* AND YOU ARE RESPONSIBLE FOR OBTAINING ANY RIGHTS YOU MAY
REQUIRE
Quoted 3 lines
drivers/input/serio/xilinx_ps2.h
Quoted 3 lines
drivers/input/serio/xilinx_ps2.h new file +3
-0+* FOR YOUR IMPLEMENTATION. XILINX EXPRESSLY DISCLAIMS ANY +* WARRANTY WHATSOEVER WITH RESPECT TO THE ADEQUACY OF THE +* IMPLEMENTATION, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES
OR
Quoted 1 line
drivers/input/serio/xilinx_ps2.h line 19
Quoted 1 line
drivers/input/serio/xilinx_ps2.h new file +1
-0+* REPRESENTATIONS THAT THIS IMPLEMENTATION IS FREE FROM CLAIMS
OF
Quoted 1 line
drivers/input/serio/xilinx_ps2.h line 20
Quoted 1 line
drivers/input/serio/xilinx_ps2.h new file +1
-0+* INFRINGEMENT, IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS
Quoted 4 lines
drivers/input/serio/xilinx_ps2.h line 22
Quoted 1 line
drivers/input/serio/xilinx_ps2.h new file +1
-0+* FOR A PARTICULAR PURPOSE. Please drop this.
OK.
Quoted 6 lines
<snip>
drivers/input/serio/xilinx_ps2.h
Quoted 5 lines
drivers/input/serio/xilinx_ps2.h new file +5
-0+ +static u8 xps2_send (struct xps2data *drvdata,u8 *buffer_ptr); +static u8 xps2_recv (struct xps2data *drvdata,u8 *buffer_ptr); +static int xps2_initialize (struct xps2data *drvdata); +static int xps2_setup(struct device *dev, int id, struct resource
*regs_res,
Quoted 10 lines
drivers/input/serio/xilinx_ps2.h line 94
Quoted 1 line
drivers/input/serio/xilinx_ps2.h new file +1
-0+ struct resource *irq_res);These can be removed by reorganizing the .c file so that callees are always above the caller.
Nice driver.
Cheers,
g.
This email and any attachments are intended for the sole use of the named recipient(s) and contain(s) confidential information that may be proprietary, privileged or copyrighted under applicable law. If you are not the intended recipient, do not read, copy, or forward this email message or any attachments. Delete this email message and any attachments immediately.
Quoted 7 lines · John Linn
Quoted 4 lines
Since
xps2_recv()andxps2_send()are used by the sxps2_* routines and by the irq handler, they should be moved to about them in this file.OK, keeping them close makes maintenance easier I guess.
Oops, there is a typo in my comment:
"... they should be moved to *above* them in this file." 'about' doesn't make much sense.
g.