Skip to contentSkip to conversation

sh: maple: add support for the Maple mouse on the SEGA Dreamcast

PATCH In review Adrian McMenamin 4 participants 11 messages Dec 29, 2008 – Jan 1, 2009

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

PATCH 1/1 sh: maple: add support for the Maple mouse on the SEGA Dreamcast

Here is a cleaned up version of the maple mouse driver - Dmitry, I tried using open and close functions as per the joystick but they seemed to get in the way of proper mouse operation. As it is the joystick does null out the callback pointer on removal of the driver, which seems to me to be the correct behaviour.

Add support for the Maple mouse on the SEGA Dreamcast.

---

drivers/input/mouse/Kconfig +11 -0
index 4e99342..71cc98a 100644
@@ -286,4 +286,15 @@ 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 the Dreamcast)"
+	depends on MAPLE
+	help
+	  This driver supports the Maple mouse on the SEGA Dreamcast.
+
+	  Most Dreamcast users, who have a mouse, will 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 +136 -0

136 lines not on this page · raw message

#1 lore raw

drivers/input/mouse/maplemouse.c line 104

Quoted 2 lines · On Monday 29 December 2008 14:17:25 Adrian McMenamin wrote:
drivers/input/mouse/maplemouse.c new file +2 -0
+static int __devinit probe_maple_mouse(struct device *dev)
+static int remove_maple_mouse(struct device *dev)

i thought you were going the rout of not labeling any of the probe/remove functions ... but if you label the prob with __devinit, then the remove should be __devexit. i.e. whichever way you go, the two should be consistent. -mike

#2 lore raw

Adding support for Maple mouse

---

drivers/input/mouse/Kconfig +11 -0
index 4e99342..71cc98a 100644
@@ -286,4 +286,15 @@ 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 the Dreamcast)"
+	depends on MAPLE
+	help
+	  This driver supports the Maple mouse on the SEGA Dreamcast.
+
+	  Most Dreamcast users, who have a mouse, will 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 +135 -0

135 lines not on this page · raw message

#3 lore raw

drivers/input/mouse/maplemouse.c line 120

Quoted 4 lines · On Monday 29 December 2008 16:30:14 Adrian McMenamin wrote:
drivers/input/mouse/maplemouse.c new file +4 -0
+static int __devexit remove_maple_mouse(struct device *dev)
+static struct maple_driver dc_mouse_driver = {
+	.drv = {
+		.remove = remove_maple_mouse,

does that really build warning free ? usually you need __devexit_p() in the .remove assignment ...
-mike

#4 lore raw
Quoted 9 lines · Mike Frysinger

drivers/input/mouse/maplemouse.c line 120

Quoted 4 lines · On Monday 29 December 2008 16:30:14 Adrian McMenamin wrote:
drivers/input/mouse/maplemouse.c new file +4 -0
+static int __devexit remove_maple_mouse(struct device *dev)
+static struct maple_driver dc_mouse_driver = {
+	.drv = {
+		.remove = remove_maple_mouse,

does that really build warning free ? usually you need __devexit_p() in the .remove assignment ...
-mike

Yep

adrian@bossclass:~/linux-2.6$ make ARCH=sh
CROSS_COMPILE=/home/adrian/dreamy-linux/buildroot/build_sh4/staging_dir/bin/sh4-linux- zImage modules -j4
scripts/kconfig/conf -s arch/sh/Kconfig
  CHK     include/linux/version.h
  SYMLINK include/asm -> include/asm-sh
make[1]: `include/asm-sh/machtypes.h' is up to date.
  CHK     include/linux/utsrelease.h
  UPD     include/linux/utsrelease.h
  CALL    scripts/checksyscalls.sh
  CHK     include/linux/compile.h
  CC      init/version.o
  CC      kernel/module.o
  LD      init/built-in.o
  CC [M]  drivers/input/mouse/maplemouse.o
  LD      kernel/built-in.o
#5 lore raw
Quoted 13 lines · Adrian McMenamin
Quoted 9 lines · Mike Frysinger

drivers/input/mouse/maplemouse.c line 120

Quoted 4 lines · On Monday 29 December 2008 16:30:14 Adrian McMenamin wrote:
drivers/input/mouse/maplemouse.c new file +4 -0
+static int __devexit remove_maple_mouse(struct device *dev)
+static struct maple_driver dc_mouse_driver = {
+	.drv = {
+		.remove = remove_maple_mouse,

does that really build warning free ? usually you need __devexit_p() in the .remove assignment ...
-mike

Yep

Quoted 15 lines
adrian@bossclass:~/linux-2.6$ make ARCH=sh
CROSS_COMPILE=/home/adrian/dreamy-linux/buildroot/build_sh4/staging_dir/bin/sh4-linux- zImage modules -j4
scripts/kconfig/conf -s arch/sh/Kconfig
  CHK     include/linux/version.h
  SYMLINK include/asm -> include/asm-sh
make[1]: `include/asm-sh/machtypes.h' is up to date.
  CHK     include/linux/utsrelease.h
  UPD     include/linux/utsrelease.h
  CALL    scripts/checksyscalls.sh
  CHK     include/linux/compile.h
  CC      init/version.o
  CC      kernel/module.o
  LD      init/built-in.o
  CC [M]  drivers/input/mouse/maplemouse.o
  LD      kernel/built-in.o

Look for an increase in section mismatch warning or try to build with:
make CONFIG_DEBUG_SECTION_MISMATCH=y

Sam

#6 lore raw
Quoted 4 lines · Sam Ravnborg

Look for an increase in section mismatch warning or try to build with:
make CONFIG_DEBUG_SECTION_MISMATCH=y

Just rebuilt the whole thing from scratch with that turned on and no extra warnings at all.

#7 lore raw
Quoted 7 lines · On Monday 29 December 2008 17:17:53 Adrian McMenamin wrote:
Quoted 3 lines · Sam Ravnborg

Look for an increase in section mismatch warning or try to build with:
make CONFIG_DEBUG_SECTION_MISMATCH=y

Just rebuilt the whole thing from scratch with that turned on and no extra warnings at all.

regardless, please add the aforementioned wrapping. this comes up from time to time in various configurations.
-mike

maintainer
#8 lore raw
Quoted 11 lines · On Monday 29 December 2008 14:19:42 Mike Frysinger wrote:
Quoted 7 lines · On Monday 29 December 2008 17:17:53 Adrian McMenamin wrote:
Quoted 3 lines · Sam Ravnborg

Look for an increase in section mismatch warning or try to build with:
make CONFIG_DEBUG_SECTION_MISMATCH=y

Just rebuilt the whole thing from scratch with that turned on and no extra warnings at all.

regardless, please add the aforementioned wrapping. this comes up from time to time in various configurations.

It could be that neither of the platforms this driver is running on defines CONFIG_HOTPLUG and then I think it is harmless but yes, we better have __devexit_p() there.

Signature · 1 line
Dmitry
#9 lore raw

Adding maple mouse with proper __devexit_p() handling

---

drivers/input/mouse/Kconfig +11 -0
index 4e99342..71cc98a 100644
@@ -286,4 +286,15 @@ 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 the Dreamcast)"
+	depends on MAPLE
+	help
+	  This driver supports the Maple mouse on the SEGA Dreamcast.
+
+	  Most Dreamcast users, who have a mouse, will 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 +135 -0

135 lines not on this page · raw message

#10 lore raw
Quoted 1 line · On Tuesday 30 December 2008 15:27:05 Adrian McMenamin wrote:

Adding maple mouse with proper __devexit_p() handling

this kind of patch revision info typically goes below the --- marker and the patch itself gets "v2", "v3", etc... header markers

otherwise, driver looks OK to me. thanks for your dreamcast work.

drivers/input/mouse/maplemouse.c line 60

Quoted 1 line
drivers/input/mouse/maplemouse.c new file +1 -0
+	mse = kzalloc(sizeof(struct dc_mouse), GFP_KERNEL);

personally i find this style less likely to rot:
mse = kzalloc(sizeof(*mse), GFP_KERNEL);
-mike