Skip to contentSkip to conversation

SuperIO locks coordinator - add the module

PATCH In review Jim Cromie 1 participant 1 message Oct 15, 2007 Hardware monitoring

lore
Share & tools
lore

Jim Cromie

author
#0 lore raw

PATCH 1/5 SuperIO locks coordinator - add the module

01 - adds superio_locks module

User-drivers specify the sio-port characteristics they can support device-ids, sio-port-addrs, enter & exit sequences, etc in a struct superio_search (in __devinit, preferably).

superio_find() then searches existing slots/shared-reservations for a matching sio-port, and returns it if found. Otherwize it probes port-addrs, specified by find() user, and makes and returns a new reservation.

superio_find() finds and reserves the slot,
returned as ptr or null
superio_release() relinguishes the slot (ref-counted)

Once theyve got the reservation in struct superio * gate (as named in patches 2-5) they *may* use

superio_lock(gate)
superio_enter/exit(gate)
superio_inb/w(gate, regaddr),
superio_outb/w(gate, regaddr, val)

or they can do it themselves with inb/outb, by using gate->sioaddr, etc.

The API names (superio_find etc) were chosen to fit the idiom used in hwmon/*.c, patches 2-5 remove the per-user-driver copies of the superio_*() fns.

I added the module to /drivers/hwmon, mostly cuz thats where Ive used it - perhaps drivers/isa is better ?

---
hwmon-superio-module

 drivers/hwmon/Kconfig         |    9 +
 drivers/hwmon/Makefile        |    1 
 drivers/hwmon/superio_locks.c |  235 ++++++++++++++++++++++++++++++++++++++++++
 include/linux/superio-locks.h |  112 ++++++++++++++++++++
 4 files changed, 357 insertions(+)
drivers/hwmon/Kconfig +9 -0
diff -ruNp -X dontdiff -X exclude-diffs hwmon-fan-push-offset/drivers/hwmon/Kconfig hwmon-superio.old/drivers/hwmon/Kconfig
@@ -750,4 +765,13 @@ config HWMON_DEBUG_CHIP
 	  a problem with I2C support and want to see more of what is going
 	  on.
 
+config SUPERIO_LOCKS
+	tristate "Super-IO port sharing"
+	default n
+	help
+	  This module provides a shared reservation for use by drivers
+	  which need to share access to a multi-function device via
+	  its superio port, and which register that port.
+
 endif # HWMON
+
drivers/hwmon/Makefile +1 -0
diff -ruNp -X dontdiff -X exclude-diffs hwmon-fan-push-offset/drivers/hwmon/Makefile hwmon-superio.old/drivers/hwmon/Makefile
@@ -72,3 +72,4 @@ ifeq ($(CONFIG_HWMON_DEBUG_CHIP),y)
 EXTRA_CFLAGS += -DDEBUG
 endif
 
+obj-$(CONFIG_SUPERIO_LOCKS)	+= superio_locks.o
drivers/hwmon/superio_locks.c +235 -0

235 lines not on this page · raw message

include/linux/superio-locks.h +112 -0

112 lines not on this page · raw message

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors