Skip to contentSkip to conversation

sh: maple: Dreamcast mouse driver

RFC PATCH In review Adrian McMenamin 2 participants 2 messages Dec 28, 2008 – Dec 29, 2008

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

RFC PATCH 1/1 sh: maple: Dreamcast mouse driver

The last time I posted patches for maple devices there were a number of problems, so this is a request for comments on the fix of the old mouse driver.

Driver for mouse on the SEGA Dreamcast

---

drivers/input/mouse/Kconfig +12 -0
index 4e99342..9e5c644 100644
@@ -286,4 +286,17 @@ config MOUSE_GPIO
 	  To compile this driver as a module, choose M here: the
 	  module will be called gpio_mouse.
 
+config MOUSE_MAPLE
+	tristate "Maple mouse (for Dreamcast)"
+	depends on MAPLE
+	help
+	  Say Y here to support the mouse on the SEGA Dreamcast.
+
+	  Most Dreamcast users (with a mouse) will want to say Y here.
+
+	  To compile this driver as a module, choose M here: the module will
+	  be called maplemouse.
+
+
 endif
drivers/input/mouse/Makefile +1 -0
index 96f1dd8..0272f5d 100644
@@ -17,6 +17,7 @@ obj-$(CONFIG_MOUSE_SERIAL)	+= sermouse.o
 obj-$(CONFIG_MOUSE_HIL)		+= hil_ptr.o
 obj-$(CONFIG_MOUSE_VSXXXAA)	+= vsxxxaa.o
 obj-$(CONFIG_MOUSE_GPIO)	+= gpio_mouse.o
+obj-$(CONFIG_MOUSE_MAPLE)	+= maplemouse.o
 
 psmouse-objs := psmouse-base.o synaptics.o
 
drivers/input/mouse/maplemouse.c new file +139 -0

139 lines not on this page · raw message

maintainer
#1 lore raw

Hi Adrian,

drivers/input/mouse/maplemouse.c line 64

Quoted 7 lines · On Sunday 28 December 2008 15:49:57 Adrian McMenamin wrote:
drivers/input/mouse/maplemouse.c new file +7 -0
+
+	mdev = to_maple_dev(dev);
+	mdrv = to_maple_driver(dev->driver);
+	if (!mdrv||!mdev) {
+		error = EINVAL;
+		goto fail;
+	}

This still does not make sense, mdev and mdrv will never be NULL.

drivers/input/mouse/maplemouse.c line 103

Quoted 2 lines
drivers/input/mouse/maplemouse.c new file +2 -0
+fail:
+	return -error;

You just negated the error returned by input_register_device() and the module loading code will think that probe succeeded.

drivers/input/mouse/maplemouse.c line 112

Quoted 7 lines
drivers/input/mouse/maplemouse.c new file +7 -0
+
+static int remove_maple_mouse(struct device *dev)
+{
+	struct maple_device *mdev = to_maple_dev(dev);
+	struct dc_mouse *mse = maple_get_drvdata(mdev);
+
+	mdev->callback = NULL;

I am uneasy about just whacking a NULL there. The other driver you sent implemented open and close methods and used maple_getcond_callback to manipulate callbacks which I assume is safer than just resetting the pointer.

Signature · 1 line
Dmitry