Skip to contentSkip to conversation

kconfig: linux.pot for all arch

PATCH New Egry Gábor 11 participants 15 messages Jul 10, 2005 – Aug 15, 2005

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

PATCH 3/3 kconfig: linux.pot for all arch

The 'make update-po-config' creates the .pot file for the default arch. This patch enhances it with all arch.

---

 Makefile |   16 ++++++++++++++--
 1 files changed, 14 insertions(+), 2 deletions(-)

diff -Nru linux-2.6.13-rc2/scripts/kconfig/Makefile linux-2.6.13-rc2-i18n-kconfig/scripts/kconfig/Makefile
--- linux-2.6.13-rc2/scripts/kconfig/Makefile 2005-07-09
12:16:04.000000000 +0200
+++ linux-2.6.13-rc2-i18n-kconfig/scripts/kconfig/Makefile 2005-07-10
21:13:00.000000000 +0200
@@ -27,8 +27,20 @@

 	xgettext --default-domain=linux \
           --add-comments --keyword=_ --keyword=N_ \
           --files-from=scripts/kconfig/POTFILES.in \

- -o scripts/kconfig/linux.pot
- scripts/kconfig/kxgettext arch/$(ARCH)/Kconfig >>
scripts/kconfig/linux.pot
+ --output scripts/kconfig/config.pot
+ $(Q)ln -fs Kconfig_i386 arch/um/Kconfig_arch
+ $(Q)for i in ls arch/; \
+ do \
+ scripts/kconfig/kxgettext arch/$$i/Kconfig \
+ | msguniq -o scripts/kconfig/linux_$${i}.pot; \
+ done
+ $(Q)msgcat scripts/kconfig/config.pot \
+ find scripts/kconfig/ -type f -name linux_*.pot \
+ --output scripts/kconfig/linux_raw.pot
+ $(Q)msguniq --sort-by-file scripts/kconfig/linux_raw.pot \
+ --output scripts/kconfig/linux.pot
+ $(Q)rm -f arch/um/Kconfig_arch
+ $(Q)rm -f scripts/kconfig/linux_*.pot scripts/kconfig/config.pot

.PHONY: randconfig allyesconfig allnoconfig allmodconfig defconfig

#1 lore raw

PATCH 1/1 spi

Hello all,

Here is the spi core patch (slightly redesigned again). Now it operates with three abstractions:
a) the spi bus, which is registered in system and is resposible for general things like registering devices on it, handling PM events for entire bus, providing bus-wide operations;
b) the spi device, which is responsible for interactions between the device and the bus (selecting/deselecting device) and PM events for the specifi device;
c) the driver, which is attached to spi devices and (possibly) provide interface to the upper level like block device interface. The spi-dev is the good starting point for people who does not want anything but simple character device access.
The new abstraction is the spi bus, which functionality was represented by spi_device structure.

Especially for Greg K-H: yes, I ran this code through sparse :), thank you.

Kernel-version: 2.6.12

This patch is to provide SPI support on linux

 drivers/Kconfig          |    2
 drivers/Makefile         |    1
 drivers/spi/Kconfig      |   33 ++++
 drivers/spi/Makefile     |   12 +
 drivers/spi/spi-core.c   |  327 +++++++++++++++++++++++++++++++++++++++++++++++ 
 drivers/spi/spi-dev.c    |  303 +++++++++++++++++++++++++++++++++++++++++++
 drivers/spi/spi_locals.h |   10 +
 include/linux/spi.h      |  148 +++++++++++++++++++++
 8 files changed, 836 insertions(+)
drivers/Kconfig +2 -0
Index: linux-2.6.10/drivers/Kconfig
===================================================================
@@ -42,6 +42,8 @@
 
 source "drivers/i2c/Kconfig"
 
+source "drivers/spi/Kconfig"
+
 source "drivers/w1/Kconfig"
 
 source "drivers/misc/Kconfig"
drivers/Makefile +1 -0
Index: linux-2.6.10/drivers/Makefile
===================================================================
@@ -67,1 +67,2 @@
 obj-$(CONFIG_MMC)		+= mmc/
+obj-$(CONFIG_SPI)               += spi/
drivers/spi/Kconfig +33 -0
Index: linux-2.6.10/drivers/spi/Kconfig
===================================================================
@@ -0,0 +1,33 @@
+#
+# SPI device configuration
+#
+menu "SPI support"
+
+config SPI
+	default Y
+	tristate "SPI support"
+        default false
+	help
+	  Say Y if you need to enable SPI support on your kernel
+
+config SPI_DEBUG
+	bool "SPI debug output" 
+	depends on SPI 
+	default false 
+	help 
+          Say Y there if you'd like to see debug output from SPI drivers.
+	  If unsure, say N
+	
+config SPI_CHARDEV
+	default Y
+	tristate "SPI device interface"
+	depends on SPI
+	help
+	  Say Y here to use spi-* device files, usually found in the /dev
+	  directory on your system.  They make it possible to have user-space
+	  programs use the SPI bus. 
+	  This support is also available as a module.  If so, the module 
+	  will be called spi-dev.
+
+endmenu
+
drivers/spi/Makefile +12 -0
Index: linux-2.6.10/drivers/spi/Makefile
===================================================================
@@ -0,0 +1,12 @@
+#
+# Makefile for the kernel spi bus driver.
+#
+
+obj-$(CONFIG_SPI) += spi-core.o helpers.o
+
+obj-$(CONFIG_SPI_CHARDEV) += spi-dev.o
+
+ifeq ($(CONFIG_SPI_DEBUG),y)
+EXTRA_CFLAGS += -DDEBUG
+endif
+
drivers/spi/spi-core.c +327 -0

327 lines not on this page · raw message

drivers/spi/spi-dev.c +303 -0

303 lines not on this page · raw message

drivers/spi/spi_locals.h +10 -0
Index: linux-2.6.10/drivers/spi/spi_locals.h
===================================================================
@@ -0,0 +1,10 @@
+#ifndef __SPI_LOCAL_H
+#define __SPI_LOCAL_H
+
+#define SPI_DRV( n ) container_of( n, struct spi_driver, driver )
+#define SPI_DEV( n ) container_of( n, struct spi_device, dev )
+
+#define ENTER() pr_debug( "%s: ENTERed\n", __FUNCTION__ )
+#define LEAVE() pr_debug( "%s: LEFT OUT\n", __FUNCTION__ )
+
+#endif				/* __SPI_LOCAL_H */
include/linux/spi.h +148 -0

148 lines not on this page · raw message

#2 lore raw

Re: [PATCH] spi

dmitry pervushin napsal(a):

drivers/spi/Makefile line 5

Quoted 12 lines

Index: linux-2.6.10/drivers/spi/Makefile
===================================================================

drivers/spi/Makefile +5 -0
@@ -0,0 +1,12 @@
+#
+# Makefile for the kernel spi bus driver.
+#
+
+obj-$(CONFIG_SPI) += spi-core.o helpers.o

But where are helpers?

#3 lore raw

Re: [PATCH] spi

In reply to dmitry pervushin
Quoted 27 lines · --- dmitry pervushin

Hello all,

Here is the spi core patch (slightly redesigned again). Now it operates
with three abstractions:
a) the spi bus, which is registered in system and is resposible for
general things like registering devices on it, handling PM events for
entire bus, providing bus-wide operations;
b) the spi device, which is responsible for interactions between the
device and the bus (selecting/deselecting device) and PM events for the
specifi device;
c) the driver, which is attached to spi devices and (possibly) provide
interface to the upper level like block device interface. The spi-dev is
the good starting point for people who does not want anything but simple
character device access.
The new abstraction is the spi bus, which functionality was represented
by spi_device structure.

Quoted 4 lines

Especially for Greg K-H: yes, I ran this code through sparse :), thank
you.

Please can we have an example client driver as it would aid understanding :-). But in the mean time.

-= snip =-

+/**
+ * spi_add_adapter - register a new SPI bus adapter
+ * @spidev: spi_device structure for the registering adapter
+ *
+ * Make the adapter available for use by clients using name
adap->name.
+ * The adap->adapters list is initialised by this function.
+ *
+ * Returns error code ( 0 on success ) ;
+ */
+struct spi_bus* spi_bus_find( char* id )
+{
+ struct bus_type* the_bus = find_bus( id );
+
+ return the_bus ? container_of( the_bus, struct
spi_bus, the_bus ) :
NULL;
+}

Eh? The comment is for spi_add_adapter but the function is spi_bus_find! Where is spi_add_adapter?

-= snip =-

+/**
+ * spi_del_adapter - unregister a SPI bus adapter
+ * @dev: spi_device structure to unregister
+ *
+ * Remove an adapter from the list of available SPI Bus adapters.
+ *
+ * Returns error code (0 on success);
+ */
+
+void spi_device_del(struct spi_device *dev) +{
+ device_unregister(&dev->dev);
+}

Eh? The comment is for spi_del_adapter but the function is spi_device_del! Where is spi_del_adapter?

-= snip =-

+/**
+ * spi_transfer - transfer information on an SPI bus
+ * @adap: adapter structure to perform transfer on
+ * @msgs: array of spi_msg structures describing transfer
+ * @num: number of spi_msg structures
+ *
+ * Transfer the specified messages to/from a device on the SPI bus.
+ *
+ * Returns number of messages successfully transferred, otherwise
negative
+ * error code.
+ */
+int spi_transfer(struct spi_device *dev, struct spi_msg msgs[], int
num)
+{
+ int ret = -ENOSYS;
+ struct spi_bus* bus;
+
+ bus = TO_SPI_BUS( dev->dev.bus );
+
+ if (bus->xfer) {
+ down( &dev->lock );
+ ret = bus->xfer(bus, dev, msgs, num, 0);
+ up(&dev->lock);
+ }
+ return ret;
+}

Surely this should be locked with bus lock?

-= snip =-

Some other comments:
1) I think you need to fix some of your comments especially those describing how the interfaces work.
2) I take it spi adaptor drivers now use spi_bus_register/spi_bus_unregister?
3) Different clients on one bus will want to run at different speeds, how will you handle this?
3) This subsystem can only handle small transfers like I2C. SPI peripherals like SPI Ethernet devices will have to do lots of large transfers and with your current subsystem the device will be forced to wait until its transfer has finished (as well as other clients) when it might have other important work to do.

Best Regards,

Mark

___________________________________________________________
Yahoo! Messenger - NEW crystal clear PC to PC calling worldwide with voicemail http://uk.messenger.yahoo.com

#4 lore raw

Re: [PATCH] spi

Quoted 2 lines

Surely this should be locked with bus lock?

Why not ? Until the transfer on device is not finished, the bus will be locked. Otherwise, the another device (on the same bus) might want to transfer something...

Quoted 17 lines

-= snip =-

Some other comments:
1) I think you need to fix some of your comments especially those describing how the interfaces work.
2) I take it spi adaptor drivers now use spi_bus_register/spi_bus_unregister?
3) Different clients on one bus will want to run at different speeds, how will you handle this?
3) This subsystem can only handle small transfers like I2C. SPI peripherals like SPI Ethernet devices will have to do lots of large transfers and with your current subsystem the device will be forced to wait until its transfer has finished (as well as other clients) when it might have other important work to do.

Hmm.. In the sample (it needs some polishing!), the bus initiates the DMA transfers and waits for completion on it. Do you want to have something like state machine (the function that will be called upon the end of transfer ?)

 Kconfig             |   12 +
 Makefile            |    7
 pnxalloc.c          |   70 ++++++
 pnxalloc.h          |    9
 spi-pnx010x_atmel.c |   91 ++++++++
 spipnx-resources.h  |  138 ++++++++++++
 spipnx.c            |  581 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 
 spipnx.h            |  309 +++++++++++++++++++++++++++
 8 files changed, 1455 insertions(+)
drivers/spi/spipnx-resources.h new file +138 -0
Index: linux-2.6.10/drivers/spi/spipnx-resources.h
===================================================================
@@ -0,0 +1,138 @@
+#ifdef CONFIG_MACH_PNX0106_GH450
+struct resource spipnx_010x_resources_0[] = 
+{
+	{ 
+	  .start = BLAS_SPI0_BASE, 
+	  .end = BLAS_SPI0_BASE + SZ_4K, 
+	  .flags = IORESOURCE_MEM,
+	}, { 
+	  .start = SPI0_FIFO_DMA_SLAVE_NR, 
+	  .flags = IORESOURCE_DMA,
+	},
+	/*
+	 * Note that the clocks are shutdown in this order and resumed
+	 * in the opposite order.
+	 */
+       	{ 
+	  .start = CGU_SWITCHBOX_BLAS_SPI0_PCLK_ID, 
+	  .flags = IORESOURCE_CLOCK_ID,
+	}, {
+	  .start = CGU_SWITCHBOX_BLAS_SPI0_PCLK_GAT_ID,
+	  .flags = IORESOURCE_CLOCK_ID,
+	}, {
+	  .start = CGU_SWITCHBOX_BLAS_SPI0_FIFO_PCLK_ID,
+	  .flags = IORESOURCE_CLOCK_ID,
+	}, { 
+	   .start = CGU_SWITCHBOX_BLAS_SPI0_DUMMY_VPBCLK_ID, 
+	  .flags = IORESOURCE_CLOCK_ID,
+	}, {
+	  .start = VH_INTC_INT_NUM_BLAS_SPI0_INT, 
+	  .flags =  IORESOURCE_IRQ,
+	}, {
+	   .flags = 0,
+	}
+};
+
+struct resource spipnx_010x_resources_1[] = 
+{
+	{ 
+	  .start = BLAS_SPI1_BASE, 
+	  .end = BLAS_SPI1_BASE + SZ_4K, 
+	  .flags = IORESOURCE_MEM,
+	}, { 
+	  .start = SPI1_FIFO_DMA_SLAVE_NR, 
+	  .flags = IORESOURCE_DMA,
+	}, 
+	/*
+	 * Note that the clocks are shutdown in this order and resumed
+	 * in the opposite order.
+	 */
+	{ 
+	  .start = CGU_SWITCHBOX_BLAS_SPI1_PCLK_ID, 
+	  .flags = IORESOURCE_CLOCK_ID,
+	}, { 
+	   .start = CGU_SWITCHBOX_BLAS_SPI1_PCLK_GAT_ID,
+	   .flags = IORESOURCE_CLOCK_ID,
+	}, { 
+	  .start = CGU_SWITCHBOX_BLAS_SPI1_FIFO_PCLK_ID,
+	  .flags = IORESOURCE_CLOCK_ID,
+	}, {
+	   .start = CGU_SWITCHBOX_BLAS_SPI1_DUMMY_VPBCLK_ID, 
+	  .flags = IORESOURCE_CLOCK_ID,
+	}, {
+	  .start = VH_INTC_INT_NUM_BLAS_SPI1_INT, 
+	  .flags =  IORESOURCE_IRQ,
+	}, {
+	   .flags = 0,
+	}
+};
+#endif
+
+#ifdef CONFIG_MACH_PNX0105_GH448
+struct resource spipnx_010x_resources[] = 
+{
+	{ 
+	  .start = BLAS_SPI_BASE, 
+	  .end = BLAS_SPI_BASE + SZ_4K, 
+	  .flags = IORESOURCE_MEM,
+	}, { 
+	  .start = BLAS_SPI_DMA_SLAVE_NR, 
+	  .flags = IORESOURCE_DMA,
+	}, 
+	/*
+	 * Note that the clocks are shutdown in this order and resumed
+	 * in the opposite order.
+	 */
+	{
+	   .start =  CGU_SWITCHBOX_BLAS_SPI_PCLK_ID,
+	   .flags = IORESOURCE_CLOCK_ID,
+	}, {
+	   .start = CGU_SWITCHBOX_BLAS_SPI_PCLK_GAT_ID,
+	   .flags = IORESOURCE_CLOCK_ID,
+	}, {
+	   .start = CGU_SWITCHBOX_BLAS_SPI_FIFO_PCLK_ID,
+	   .flags = IORESOURCE_CLOCK_ID,
+	}, { 
+	  .start = VH_INTC_INT_NUM_BLAS_SPI_INT, 
+	  .flags =  IORESOURCE_IRQ,
+	}, {
+	   .flags = 0,
+	}
+};
+#endif
+
+#ifdef CONFIG_ARCH_PNX4008
+struct resource spipnx_4008_resources_0[] = 
+{
+	{ 	      
+	  .start = PNX4008_SPI1_BASE, 
+	  .end = PNX4008_SPI1_BASE + SZ_4K, 
+	  .flags = IORESOURCE_MEM,
+	}, { 
+	  .start = 11 /* SPI1_DMA_PERIPHERAL_ID */, 
+	  .flags = IORESOURCE_DMA,
+	}, { 
+	  .start = SPI1_INT, 
+	  .flags =  IORESOURCE_IRQ,
+	}, {
+	   .flags = 0,
+	}
+};
+
+struct resource spipnx_4008_resources_1[] = 
+{
+	{ 	      
+	  .start = PNX4008_SPI2_BASE, 
+	  .end = PNX4008_SPI2_BASE + SZ_4K, 
+	  .flags = IORESOURCE_MEM,
+	}, { 
+	  .start = 12 /* SPI2_DMA_PERIPHERAL_ID */, 
+	  .flags = IORESOURCE_DMA,
+	}, { 
+	  .start = SPI2_INT, 
+	  .flags =  IORESOURCE_IRQ,
+	}, {
+	   .flags = 0,
+	}
+};
+#endif
drivers/spi/spipnx.c new file +581 -0

581 lines not on this page · raw message

drivers/spi/spi-pnx010x_atmel.c new file +91 -0

91 lines not on this page · raw message

drivers/spi/spipnx.h new file +309 -0

309 lines not on this page · raw message

drivers/spi/pnxalloc.c new file +70 -0

70 lines not on this page · raw message

drivers/spi/pnxalloc.h new file +9 -0
Index: linux-2.6.10/drivers/spi/pnxalloc.h
===================================================================
@@ -0,0 +1,9 @@
+#ifndef __PNX_ALLOC_H
+#define __PNX_ALLOC_H
+void *pnx_memory_alloc(size_t size, int base);
+void pnx_memory_free(const void *data);
+unsigned long pnx_copy_from_user(void *to, const void *from_user,
+				 unsigned long len);
+unsigned long pnx_copy_to_user(void *to_user, const void *from,
+			       unsigned long len);
+#endif
drivers/spi/Kconfig +12 -0
Index: linux-2.6.10/drivers/spi/Kconfig
===================================================================
@@ -29,5 +29,17 @@
 	  This support is also available as a module.  If so, the module 
 	  will be called spi-dev.
 
+config SPI_PNX
+	tristate "PNX SPI bus support"
+	depends on SPI
+
+config SPI_PNX010X_ATMEL
+	tristate "Atmel Flash chip on PNX010x SPI support"
+	depends on SPI_PNX && ARCH_PNX010X
+
+config SPI_PNX4008_EEPROM
+	tristate "Dummy EEPROM driver"
+	depends on SPI_PNX && ARCH_PNX4008
+
 endmenu
 
drivers/spi/Makefile +6 -0
Index: linux-2.6.10/drivers/spi/Makefile
===================================================================
@@ -4,6 +4,13 @@
 
 obj-$(CONFIG_SPI) += spi-core.o helpers.o
 
+obj-$(CONFIG_SPI_PNX)            += spipnx.o 
+obj-$(CONFIG_SPI_PNX010X_ATMEL)  += spi-pnx010x_atmel.o 
+
+obj-$(CONFIG_ARCH_PNX4008)       += pnxalloc.o
+obj-$(CONFIG_ARCH_PNX010X)       += pnxalloc.o
+
 obj-$(CONFIG_SPI_CHARDEV) += spi-dev.o
 
 ifeq ($(CONFIG_SPI_DEBUG),y)
#5 lore raw

Re: [PATCH] spi

Quoted 7 lines · --- dmitry pervushin
Quoted 2 lines

Surely this should be locked with bus lock?

Why not ? Until the transfer on device is not finished, the bus will be
locked. Otherwise, the another device (on the same bus) might want to
transfer something...

OK. My confusion was that we are also working on a SPI subsystem which works in a different way.
Our SPI subsystem works much like the USB subsystem in that drivers can queue up transfers and they will get a callback when the transfer is complete. Actually I think we have 4 modes of operation which also allows transfers to be done in interrupt context, with callback, wait for completion or high priority (used to transfer high priority messages by bypassing the transfer queue). I'll see if I can submit a patch to the mailing list as I know its not only ideas but code that counts ;-).

Quoted 22 lines
Quoted 6 lines

-= snip =-

Some other comments:
1) I think you need to fix some of your comments especially those describing how the interfaces

work.

Quoted 3 lines

2) I take it spi adaptor drivers now use spi_bus_register/spi_bus_unregister?
3) Different clients on one bus will want to run

at

Quoted 2 lines

different speeds, how will you handle this?
3) This subsystem can only handle small transfers

like

Quoted 1 line

I2C. SPI peripherals like SPI Ethernet devices

will

Quoted 2 lines

have to do lots of large transfers and with your current subsystem the device will be forced to

wait

Quoted 2 lines

until its transfer has finished (as well as other clients) when it might have other important work

to

Quoted 8 lines
Quoted 1 line

do.

Hmm.. In the sample (it needs some polishing!), the bus initiates the
DMA transfers and waits for completion on it. Do you want to have
something like state machine (the function that will be called upon the
end of transfer ?)

Yes, please see above.

Quoted 9 lines

 Kconfig             |   12 +
 Makefile            |    7
 pnxalloc.c          |   70 ++++++
 pnxalloc.h          |    9
 spi-pnx010x_atmel.c |   91 ++++++++
 spipnx-resources.h  |  138 ++++++++++++
 spipnx.c            |  581
Quoted 8 lines

++++++++++++++++++++++++++++++++++++++++++++++++++++

 spipnx.h            |  309
+++++++++++++++++++++++++++
 8 files changed, 1455 insertions(+)

Index: linux-2.6.10/drivers/spi/spipnx-resources.h

===================================================================

Quoted 146 lines
drivers/spi/spipnx-resources.h new file +13 -0
@@ -0,0 +1,138 @@
+#ifdef CONFIG_MACH_PNX0106_GH450
+struct resource spipnx_010x_resources_0[] = 
+{
+	{ 
+	  .start = BLAS_SPI0_BASE, 
+	  .end = BLAS_SPI0_BASE + SZ_4K, 
+	  .flags = IORESOURCE_MEM,
+	}, { 
+	  .start = SPI0_FIFO_DMA_SLAVE_NR, 
+	  .flags = IORESOURCE_DMA,
+	},
+	/*
+	 * Note that the clocks are shutdown in this order

and resumed

drivers/spi/spipnx-resources.h new file +13 -0
+	 * in the opposite order.
+	 */
+       	{ 
+	  .start = CGU_SWITCHBOX_BLAS_SPI0_PCLK_ID, 
+	  .flags = IORESOURCE_CLOCK_ID,
+	}, {
+	  .start = CGU_SWITCHBOX_BLAS_SPI0_PCLK_GAT_ID,
+	  .flags = IORESOURCE_CLOCK_ID,
+	}, {
+	  .start = CGU_SWITCHBOX_BLAS_SPI0_FIFO_PCLK_ID,
+	  .flags = IORESOURCE_CLOCK_ID,
+	}, { 
+	   .start =

CGU_SWITCHBOX_BLAS_SPI0_DUMMY_VPBCLK_ID,

drivers/spi/spipnx-resources.h new file +21 -0
+	  .flags = IORESOURCE_CLOCK_ID,
+	}, {
+	  .start = VH_INTC_INT_NUM_BLAS_SPI0_INT, 
+	  .flags =  IORESOURCE_IRQ,
+	}, {
+	   .flags = 0,
+	}
+};
+
+struct resource spipnx_010x_resources_1[] = 
+{
+	{ 
+	  .start = BLAS_SPI1_BASE, 
+	  .end = BLAS_SPI1_BASE + SZ_4K, 
+	  .flags = IORESOURCE_MEM,
+	}, { 
+	  .start = SPI1_FIFO_DMA_SLAVE_NR, 
+	  .flags = IORESOURCE_DMA,
+	}, 
+	/*
+	 * Note that the clocks are shutdown in this order

and resumed

drivers/spi/spipnx-resources.h new file +13 -0
+	 * in the opposite order.
+	 */
+	{ 
+	  .start = CGU_SWITCHBOX_BLAS_SPI1_PCLK_ID, 
+	  .flags = IORESOURCE_CLOCK_ID,
+	}, { 
+	   .start = CGU_SWITCHBOX_BLAS_SPI1_PCLK_GAT_ID,
+	   .flags = IORESOURCE_CLOCK_ID,
+	}, { 
+	  .start = CGU_SWITCHBOX_BLAS_SPI1_FIFO_PCLK_ID,
+	  .flags = IORESOURCE_CLOCK_ID,
+	}, {
+	   .start =

CGU_SWITCHBOX_BLAS_SPI1_DUMMY_VPBCLK_ID,

drivers/spi/spipnx-resources.h new file +23 -0
+	  .flags = IORESOURCE_CLOCK_ID,
+	}, {
+	  .start = VH_INTC_INT_NUM_BLAS_SPI1_INT, 
+	  .flags =  IORESOURCE_IRQ,
+	}, {
+	   .flags = 0,
+	}
+};
+#endif
+
+#ifdef CONFIG_MACH_PNX0105_GH448
+struct resource spipnx_010x_resources[] = 
+{
+	{ 
+	  .start = BLAS_SPI_BASE, 
+	  .end = BLAS_SPI_BASE + SZ_4K, 
+	  .flags = IORESOURCE_MEM,
+	}, { 
+	  .start = BLAS_SPI_DMA_SLAVE_NR, 
+	  .flags = IORESOURCE_DMA,
+	}, 
+	/*
+	 * Note that the clocks are shutdown in this order

and resumed

drivers/spi/spipnx-resources.h new file +55 -0
+	 * in the opposite order.
+	 */
+	{
+	   .start =  CGU_SWITCHBOX_BLAS_SPI_PCLK_ID,
+	   .flags = IORESOURCE_CLOCK_ID,
+	}, {
+	   .start = CGU_SWITCHBOX_BLAS_SPI_PCLK_GAT_ID,
+	   .flags = IORESOURCE_CLOCK_ID,
+	}, {
+	   .start = CGU_SWITCHBOX_BLAS_SPI_FIFO_PCLK_ID,
+	   .flags = IORESOURCE_CLOCK_ID,
+	}, { 
+	  .start = VH_INTC_INT_NUM_BLAS_SPI_INT, 
+	  .flags =  IORESOURCE_IRQ,
+	}, {
+	   .flags = 0,
+	}
+};
+#endif
+
+#ifdef CONFIG_ARCH_PNX4008
+struct resource spipnx_4008_resources_0[] = 
+{
+	{ 	      
+	  .start = PNX4008_SPI1_BASE, 
+	  .end = PNX4008_SPI1_BASE + SZ_4K, 
+	  .flags = IORESOURCE_MEM,
+	}, { 
+	  .start = 11 /* SPI1_DMA_PERIPHERAL_ID */, 
+	  .flags = IORESOURCE_DMA,
+	}, { 
+	  .start = SPI1_INT, 
+	  .flags =  IORESOURCE_IRQ,
+	}, {
+	   .flags = 0,
+	}
+};
+
+struct resource spipnx_4008_resources_1[] = 
+{
+	{ 	      
+	  .start = PNX4008_SPI2_BASE, 
+	  .end = PNX4008_SPI2_BASE + SZ_4K, 
+	  .flags = IORESOURCE_MEM,
+	}, { 
+	  .start = 12 /* SPI2_DMA_PERIPHERAL_ID */, 
+	  .flags = IORESOURCE_DMA,
+	}, { 
+	  .start = SPI2_INT, 
+	  .flags =  IORESOURCE_IRQ,
+	}, {
+	   .flags = 0,
+	}
+};
+#endif
Quoted 2 lines

Index: linux-2.6.10/drivers/spi/spipnx.c

=== message truncated ===

___________________________________________________________
Yahoo! Messenger - NEW crystal clear PC to PC calling worldwide with voicemail http://uk.messenger.yahoo.com

#6 lore raw

Re: [PATCH] spi

In reply to dmitry pervushin

drivers/spi/Kconfig line 11

Quoted 6 lines · dmitry pervushin
drivers/spi/Kconfig +6 -0
+config SPI
+	default Y
+	tristate "SPI support"
+        default false
+	help
+	  Say Y if you need to enable SPI support on your kernel

What about the "the module will be called..." text for this?

Quoted 1 line

+obj-$(CONFIG_SPI) += spi-core.o helpers.o

Hm, this will not build :(

Quoted 1 line

+static LIST_HEAD( spi_busses );

No spaces after ( or before ) please. You do this all over the place in the code, please fix it up.

drivers/spi/spi-core.c line 36

Quoted 1 line
drivers/spi/spi-core.c +1 -0
+	if (NULL == dev || NULL == driver) {

Put the variable on the left side, gcc will complain if you incorrectly put a "=" instead of a "==" here, which is all that you are defending against with this style.

drivers/spi/spi-core.c line 47

Quoted 11 lines
drivers/spi/spi-core.c +11 -0
+		printk(KERN_ERR
+		       "%s: error - both dev and driver should not be NULL !\n",
+		       __FUNCTION__);
+		found = 0;
+		goto spi_match_done;
+	}
+
+	if (NULL == spidrv->supported_ids) {
+		printk
+		    ("%s: driver has no ids of devices to support, assuming ALL\n",
+		     __FUNCTION__);

No KERN_ level here. Also, please use dev_dbg() and friends if you possibly can, it's much better for log messages.

drivers/spi/spi-core.c line 86

Quoted 8 lines
drivers/spi/spi-core.c +8 -0
+int spi_bus_register( struct spi_bus* bus, char* name )
+{
+	int err = -EINVAL;
+	static int count = 0;
+	char busname[ BUS_ID_SIZE ];
+	char fullname[ BUS_ID_SIZE ];
+
+	ENTER();	

Tracing? ick, not really needed...

Quoted 4 lines
drivers/spi/spi-core.c +4 -0
+	if( bus ) {
+		init_MUTEX( &bus->lock );
+
+		bus->platform_device.name = NULL;

drivers/spi/spi-core.c line 100

Quoted 10 lines
drivers/spi/spi-core.c +10 -0
+		bus->the_bus.name = NULL;
+
+		strncpy( busname, name ? name : "SPI", sizeof( busname ) );
+		bus->platform_device.id = count++ % 100;
+		sprintf( fullname, "%s_%02d", busname, bus->platform_device.id);
+		bus->the_bus.name = kmalloc( strlen( fullname )+1, GFP_KERNEL );
+		if( bus->the_bus.name ) {
+			strcpy( bus->the_bus.name, fullname );
+		}
+

{ } are not needed for 1 line if statements.

drivers/spi/spi-core.c line 149

Quoted 10 lines
drivers/spi/spi-core.c +10 -0
+/**
+ * spi_add_adapter - register a new SPI bus adapter
+ * @spidev: spi_device structure for the registering adapter
+ *
+ * Make the adapter available for use by clients using name adap->name.
+ * The adap->adapters list is initialised by this function.
+ *
+ * Returns error code ( 0 on success ) ;
+ */
+struct spi_bus* spi_bus_find( char* id )

Wrong comment.

drivers/spi/spi-core.c line 156

Quoted 7 lines
drivers/spi/spi-core.c +7 -0
+{
+	struct bus_type* the_bus = find_bus( id );
+
+	return the_bus ? container_of( the_bus, struct spi_bus, the_bus ) : NULL;
+}
+
+EXPORT_SYMBOL( spi_bus_find );

EXPORT_SYMBOL_GPL ?

Quoted 1 line

+int spi_device_add( struct spi_bus* bus, struct spi_device *dev, char* name)

No space between that and the next function?

No comment for a public function ike this?

drivers/spi/spi-core.c line 187

Quoted 10 lines
drivers/spi/spi-core.c +10 -0
+/**
+ * spi_del_adapter - unregister a SPI bus adapter
+ * @dev: spi_device structure to unregister
+ *
+ * Remove an adapter from the list of available SPI Bus adapters.
+ *
+ * Returns error code (0 on success);
+ */
+
+void spi_device_del(struct spi_device *dev)

Again, comments out of sync with the code.

drivers/spi/spi-core.c line 240

Quoted 6 lines
drivers/spi/spi-core.c +6 -0
+void spi_driver_del( struct spi_driver* drv )
+{
+	driver_unregister( &drv->driver );
+}
+/**
+ * spi_transfer - transfer information on an SPI bus

Please, just 1 line of whitespace between functions, not none.

drivers/spi/spi-core.c line 277

Quoted 13 lines
drivers/spi/spi-core.c +13 -0
+/**
+ * spi_write - send data to a device on an SPI bus
+ * @client: registered client structure
+ * @addr: SPI bus address
+ * @buf: buffer for bytes to send
+ * @len: number of bytes to send
+ *
+ * Send len bytes pointed to by buf to device address addr on the SPI bus
+ * described by client.
+ *
+ * Returns the number of bytes transferred, or negative error code.
+ */
+int spi_write(struct spi_device *dev, int addr, const char *buf, int len)

Comment doesn't match function. You will catch all of these errors if you add the files to the kernel api docbook document.

drivers/spi/spi-dev.c line 1

Quoted 5 lines

===================================================================

drivers/spi/spi-dev.c +1 -0
@@ -0,0 +1,303 @@
+/*#ifdef CONFIG_DEVFS_FS	

What's with the #ifdef here?

drivers/spi/spi-dev.c line 40

Quoted 2 lines
drivers/spi/spi-dev.c +2 -0
+
+/* $Id: common_spi_core-2.patch,v 1.1.2.6 2005/07/15 07:24:40 tpoynor Exp $ */

No CVS ids in kernel code please.

drivers/spi/spi-dev.c line 59

Quoted 1 line
drivers/spi/spi-dev.c +1 -0
+/* struct file_operations changed too often in the 2.1 series for nice code */

I don't think this comment is necessary anymore :)

drivers/spi/spi-dev.c line 64

Quoted 4 lines
drivers/spi/spi-dev.c +4 -0
+static ssize_t spidev_read(struct file *file, char *buf, size_t count,
+			   loff_t * offset);
+static ssize_t spidev_write(struct file *file, const char *buf, size_t count,
+			    loff_t * offset);

You didn't run this through sparse :(

That's enough to start with...

thanks,

greg k-h

#7 lore raw

Re: [PATCH] spi

Hi Greg,

Quoted 8 lines

No spaces after ( or before ) please. You do this all over the place in the code, please fix it up.

drivers/spi/spi-core.c line 36

Quoted 1 line
drivers/spi/spi-core.c +1 -0
+	if (NULL == dev || NULL == driver) {

Put the variable on the left side, gcc will complain if you incorrectly put a "=" instead of a "==" here, which is all that you are defending against with this style.

I think in this case the preferred way is

	if (!dev || !driver) {

Regards

Marcel

#8 lore raw

Re: [PATCH] spi

Quoted 10 lines · Marcel Holtmann
Quoted 5 lines

drivers/spi/spi-core.c line 36

Quoted 1 line
drivers/spi/spi-core.c +1 -0
+	if (NULL == dev || NULL == driver) {

Put the variable on the left side, gcc will complain if you incorrectly put a "=" instead of a "==" here, which is all that you are defending against with this style.

I think in this case the preferred way is

	if (!dev || !driver) {

That's not a guaranteed equivalence in the C standard. Null pointers may not be zero. I don't think we have any targets that work this way, however there is nothing wrong with explicitly testing for NULL.

#9 lore raw

Re: [PATCH] spi

Quoted 7 lines · Marc Singer
Quoted 6 lines · Marcel Holtmann
Quoted 5 lines

drivers/spi/spi-core.c line 36

Quoted 1 line
drivers/spi/spi-core.c +1 -0
+	if (NULL == dev || NULL == driver) {

Put the variable on the left side, gcc will complain if you incorrectly put a "=" instead of a "==" here, which is all that you are defending against with this style.

Quoted 8 lines
Quoted 4 lines

I think in this case the preferred way is

	if (!dev || !driver) {

That's not a guaranteed equivalence in the C standard. Null pointers may not be zero. I don't think we have any targets that work this way, however there is nothing wrong with explicitly testing for NULL.

False. The expression "!x" is precisely equivalent to "x==0", no matter what the type of x is. [1] And furthermore, NULL==0. [2] Ergo, "NULL == dev" and "!dev" are defined to be equivalent.

What you're confused about is that the *representation* of a null pointer constant does not necessarily have to be all-bits-zero. That is, the following code fragment might print something on a standard-compliant C implementation:

	void *a = 0; unsigned char *p = (unsigned char *)&a;
	int i;
	for(i=0; i<sizeof(a); i++)
		if(p[i] != 0) printf("p[%d] = %02x!\n", i, p[i]);

That does not change the fact that the source-code fragment "NULL" is defined to be equivalent to the source-code fragment "0". Simply the compiler must do whatever trickery necessary to ensure the correct values get generated in the object code for my above hypothetical architecture when I say "void *a = 0;".

This is very similar to how floating point is handled in the abstract machine definition of the standard. Consider a weird FP implementation where 0.0 has a not-all-bits-zero representation, and change 'a' in my example above to type 'double'. Just because 0.0 is stored as the bit pattern 0x8000000000000000 does not mean that I have to write something other than "double a = 0;"!

And furthermore, all of this was well-understood in the C89 standard; it's not new in the C99 standard, although there are some clarifications.

[1] ISO/IEC 9899:1999 6.5.3.3 Unary arithmetic operators

(5) The result of the logical negation operator ! is 0 if the value of its operand compares unequal to 0, 1 if the value of its operand compares equal to 0. The result has type int. The expression !E is equivalent to (0==E).

[2] ISO/IEC 9899:1999 7.17

The following types and macros are defined in the standard header <stddef.h>. ...
NULL
which expands to an implementation-defined null pointer constant...

and 6.3.2.3 Pointers
(3) An integer constant expression with the value 0, or such an expression cast to type void *, is called a null pointer constant.

-andy

#10 lore raw

Re: [PATCH] spi

Quoted 17 lines · Andy Isaacson
Quoted 7 lines · Marc Singer
Quoted 6 lines · Marcel Holtmann
Quoted 5 lines

drivers/spi/spi-core.c line 36

Quoted 1 line
drivers/spi/spi-core.c +1 -0
+	if (NULL == dev || NULL == driver) {

Put the variable on the left side, gcc will complain if you incorrectly put a "=" instead of a "==" here, which is all that you are defending against with this style.

Quoted 8 lines
Quoted 4 lines

I think in this case the preferred way is

	if (!dev || !driver) {

That's not a guaranteed equivalence in the C standard. Null pointers may not be zero. I don't think we have any targets that work this way, however there is nothing wrong with explicitly testing for NULL.

Quoted 8 lines

False. The expression "!x" is precisely equivalent to "x==0", no matter what the type of x is. [1] And furthermore, NULL==0. [2] Ergo, "NULL == dev" and "!dev" are defined to be equivalent.

What you're confused about is that the *representation* of a null pointer constant does not necessarily have to be all-bits-zero. That is, the following code fragment might print something on a standard-compliant C implementation:

No, I'm not confused about the representation of a NULL. Keep in mind that telling someone what they do or don't understand/believe/think/feel is the fast track to being flamed.

Quoted 32 lines
	void *a = 0; unsigned char *p = (unsigned char *)&a;
	int i;
	for(i=0; i<sizeof(a); i++)
		if(p[i] != 0) printf("p[%d] = %02x!\n", i, p[i]);

That does not change the fact that the source-code fragment "NULL" is defined to be equivalent to the source-code fragment "0". Simply the compiler must do whatever trickery necessary to ensure the correct values get generated in the object code for my above hypothetical architecture when I say "void *a = 0;".

This is very similar to how floating point is handled in the abstract machine definition of the standard. Consider a weird FP implementation where 0.0 has a not-all-bits-zero representation, and change 'a' in my example above to type 'double'. Just because 0.0 is stored as the bit pattern 0x8000000000000000 does not mean that I have to write something other than "double a = 0;"!

And furthermore, all of this was well-understood in the C89 standard; it's not new in the C99 standard, although there are some clarifications.

[1] ISO/IEC 9899:1999 6.5.3.3 Unary arithmetic operators

(5) The result of the logical negation operator ! is 0 if the value of its operand compares unequal to 0, 1 if the value of its operand compares equal to 0. The result has type int. The expression !E is equivalent to (0==E).

[2] ISO/IEC 9899:1999 7.17

Quoted 8 lines

The following types and macros are defined in the standard header <stddef.h>. ...
NULL
which expands to an implementation-defined null pointer constant...

and 6.3.2.3 Pointers
(3) An integer constant expression with the value 0, or such an expression cast to type void *, is called a null pointer constant.

It was explained to me that the !pointer test wasn't guaranteed to be equivalent because of the way that the test is handled. The spec fragments above don't address how the boolean test is coerced. Does it cast pointer to an integer and perform the test, or does it cast the 0 to a pointer and perform the test. The C++ spec I have is vague on this point. The only reference it makes to pointers is that the operand for ! may be a pointer.

#11 lore raw

Re: [PATCH] spi

The code in question is

Quoted 4 lines · Marc Singer
Quoted 4 lines
Quoted 4 lines · Marcel Holtmann
Quoted 2 lines
Quoted 1 line

drivers/spi/spi-core.c line 36

Quoted 1 line
drivers/spi/spi-core.c +1 -0
+	if (NULL == dev || NULL == driver) {
	if (!dev || !driver) {
Quoted 3 lines · You
Quoted 3 lines
Quoted 3 lines

That's not a guaranteed equivalence in the C standard. Null pointers may not be zero. I don't think we have any targets that work this way, however there is nothing wrong with explicitly testing for NULL.

I quoted chapter and verse why that statement is not true:

Quoted 14 lines
Quoted 14 lines

[1] ISO/IEC 9899:1999 6.5.3.3 Unary arithmetic operators

(5) The result of the logical negation operator ! is 0 if the value of its operand compares unequal to 0, 1 if the value of its operand compares equal to 0. The result has type int. The expression !E is equivalent to (0==E).

[2] ISO/IEC 9899:1999 7.17

The following types and macros are defined in the standard header <stddef.h>. ...
NULL
which expands to an implementation-defined null pointer constant...

Quoted 6 lines
Quoted 3 lines

and 6.3.2.3 Pointers
(3) An integer constant expression with the value 0, or such an expression cast to type void *, is called a null pointer constant.

It was explained to me that the !pointer test wasn't guaranteed to be equivalent because of the way that the test is handled.

Whoever explained that to you was wrong. 6.5.3.3 is the final word on how "!x" is interpreted, and it *says* in the *text* that "!x" === "x!=0". I don't see how this could be any clearer.

Quoted 5 lines

The spec fragments above don't address how the boolean test is coerced. Does it cast pointer to an integer and perform the test, or does it cast the 0 to a pointer and perform the test. The C++ spec I have is vague on this point. The only reference it makes to pointers is that the operand for ! may be a pointer.

Because of the equivalence *given in the text of 6.5.3.3* we can simply follow the money. (I'm not concerned, here, about what ambiguities the C++ folks may or may not have introduced into their monstrosity. The Linux kernel is written in C, and the C standard is unambiguous on this point. Though frankly I'd be suprised if C++ breaks something so straightforward and useful.)

The section that defines != says

6.5.9 Equality operators
Syntax
(1) equality-expression:

                relational-expression
                equality-expression == relational-expression
                equality-expression != relational-expression

Constraints

(2) One of the following shall hold:
...
-- one operand is a pointer and the other is a null pointer constant.

(5) ... If one operand is a pointer and the other is a null pointer constant, the null pointer constant is converted to the type of the pointer. ...

So:
1. !x is defined equivalent to x!=0.
2. 0 is a "null pointer constant".
3. (assuming x is a pointer) 0 will be promoted to pointer type in the expression "x!=0".

With the facts taken care of, we can move on to

Quoted 3 lines

No, I'm not confused about the representation of a NULL. Keep in mind that telling someone what they do or don't understand/believe/think/feel is the fast track to being flamed.

On Linux-kernel, being wrong is the fast track to being flamed. When I'm wrong, I expect to be corrected. (Frankly, I'm wrong and *not* corrected much more frequently than I find comfortable.) Adjust your expectations accordingly and you may be more comfortable here.

Your original statement was wrong, so I corrected you (as much to keep the disinformation level to a low roar, as anything). The code transformation quoted at the top of this message is both
(1) well-defined by the C standard and (2) in keeping with kernel coding standards.

HTH, HAND.
-andy

#12 lore raw

Re: [PATCH] spi

Quoted 38 lines
Quoted 2 lines

It was explained to me that the !pointer test wasn't guaranteed to be equivalent because of the way that the test is handled.

Whoever explained that to you was wrong. 6.5.3.3 is the final word on how "!x" is interpreted, and it *says* in the *text* that "!x" === "x!=0". I don't see how this could be any clearer.

Quoted 5 lines

The spec fragments above don't address how the boolean test is coerced. Does it cast pointer to an integer and perform the test, or does it cast the 0 to a pointer and perform the test. The C++ spec I have is vague on this point. The only reference it makes to pointers is that the operand for ! may be a pointer.

Because of the equivalence *given in the text of 6.5.3.3* we can simply follow the money. (I'm not concerned, here, about what ambiguities the C++ folks may or may not have introduced into their monstrosity. The Linux kernel is written in C, and the C standard is unambiguous on this point. Though frankly I'd be suprised if C++ breaks something so straightforward and useful.)

The section that defines != says

6.5.9 Equality operators
Syntax
(1) equality-expression:

                relational-expression
                equality-expression == relational-expression
                equality-expression != relational-expression

Constraints

(2) One of the following shall hold:
...
-- one operand is a pointer and the other is a null pointer constant.

(5) ... If one operand is a pointer and the other is a null pointer constant, the null pointer constant is converted to the type of the pointer. ...

Quoted 5 lines

So:
1. !x is defined equivalent to x!=0.
2. 0 is a "null pointer constant".
3. (assuming x is a pointer) 0 will be promoted to pointer type in the expression "x!=0".

You are right to 99.9% ;)

The last 0.1% of wrongness comes from linux/stddef.h:
...
#define NULL ((void *)0)

Thus, !ptr is equivalent to ptr==0 but not equivalent to ptr==NULL in general case for the kernel code (it is equivalent if ptr is a variable of a _pointer type_ because ptr then implicitly converted to (void*)).

Our NULL isn't 0 by design. it's not a bug, regardless what Stroustrup says about NULL define.
--
vda

#13 lore raw

Re: [PATCH] spi

In reply to dmitry pervushin
Quoted 1 line · dmitry pervushin

A few coding style nits.

drivers/spi/spi-core.c line 27

Quoted 3 lines
drivers/spi/spi-core.c +3 -0
+#include "spi_locals.h"
+
+static LIST_HEAD( spi_busses );

Please don't put spaces after '(' and before ')'.

drivers/spi/spi-core.c line 57

Quoted 1 line
drivers/spi/spi-core.c +1 -0
+		if (0 == strncmp(*id, SPI_ID_ANY, strlen(SPI_ID_ANY))) {

And this trick isn't really needed. If you do

if (whatever = constant)

then the compiler will generate a warning. Please do these comparisons in the conventional way, with the constant on the right hand side.

drivers/spi/spi-core.c line 93

Quoted 7 lines
drivers/spi/spi-core.c +7 -0
+	if( bus ) {
+		init_MUTEX( &bus->lock );
+
+		bus->platform_device.name = NULL;
+		bus->the_bus.name = NULL;
+
+		strncpy( busname, name ? name : "SPI", sizeof( busname ) );

Lots more extraneous spaces after '(' and before ')'.

drivers/spi/spi-core.c line 99

Quoted 3 lines
drivers/spi/spi-core.c +3 -0
+		if( bus->the_bus.name ) {
+			strcpy( bus->the_bus.name, fullname );
+		}

No braces here.

drivers/spi/spi-core.c line 104

Quoted 4 lines
drivers/spi/spi-core.c +4 -0
+		err = bus_register( &bus->the_bus );
+		if( err ) {
+			goto out;
+		}

And here.

drivers/spi/spi-core.c line 109

Quoted 5 lines
drivers/spi/spi-core.c +5 -0
+		list_add_tail( &bus->bus_list, &spi_busses );
+		bus->platform_device.name = kmalloc( strlen( busname )+1, GFP_KERNEL );
+		if( bus->platform_device.name ) {
+			strcpy( bus->platform_device.name, busname );
+		}

and here...

drivers/spi/spi-core.c line 127

Quoted 3 lines
drivers/spi/spi-core.c +3 -0
+void spi_bus_unregister( struct spi_bus* bus )
+{
+	if( bus ) {

We do put a space after `if', so this line should be

	if (bus) {
Quoted 1 line

+struct spi_bus* spi_bus_find( char* id )

The asterisk goes with the variable, not with the type. So the above should be

struct spi_bus *spi_bus_find(char *id)

Quoted 1 line

+int spi_device_add( struct spi_bus* bus, struct spi_device *dev, char* name)

Here too.

Quoted 1 line

+int spi_do_probe( struct device* dev, void* device_driver )

You seem to have an awful lot of non-static functions. Please check whether they all really need to have global scope.

Review

Quoted 1 line
(quoted diff) +1 -0
+	if (NULL == dev) {
	if (dev == NULL) {

drivers/spi/spi-dev.c line 216

Quoted 3 lines
drivers/spi/spi-dev.c +3 -0
+static int spidev_do_open(struct device *the_dev, void *context)
+{
+	struct spidev_openclose *o = (struct spidev_openclose *) context;

Don't typecast void* when assigning to and from pointers. It adds clutter and defeats typechecking.

drivers/spi/spi-dev.c line 220

Quoted 4 lines
drivers/spi/spi-dev.c +4 -0
+	struct spi_device *dev = SPI_DEV(the_dev);
+	struct spidev_driver_data *drvdata;
+
+	drvdata = (struct spidev_driver_data *) dev_get_drvdata(the_dev);

Ditto.

drivers/spi/spi-dev.c line 284

Quoted 2 lines
drivers/spi/spi-dev.c +2 -0
+
+      out_unreg:

Labels go in column zero.

include/linux/spi.h line 95

Quoted 6 lines
include/linux/spi.h +6 -0
+	void *(*alloc) (size_t, int);
+	void (*free) (const void *);
+	unsigned long (*copy_from_user) (void *to, const void *from_user,
+					 unsigned long len);
+	unsigned long (*copy_to_user) (void *to_user, const void *from,
+				       unsigned long len);

The above names are risky. Some platform may implement copy_to_user() as a macro.

#14 lore raw

Re: [PATCH] spi

In reply to dmitry pervushin

Hi!

drivers/spi/Kconfig line 11

Quoted 8 lines
drivers/spi/Kconfig +8 -0
+menu "SPI support"
+
+config SPI
+	default Y
+	tristate "SPI support"
+        default false
+	help
+	  Say Y if you need to enable SPI support on your kernel

I'd expect explanation what "SPI" means somewhere around here...
Pavel

Signature · 1 line
if you have sharp zaurus hardware you don't need... you know my address