diff options
author | Grant Likely <grant.likely@secretlab.ca> | 2008-07-24 00:29:55 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-07-24 13:47:30 -0400 |
commit | 102eb97564c73ea73645b38599c5cbe6f54b030c (patch) | |
tree | c054ffd980f35d14c569204fc4dcd995544817d3 /include/linux | |
parent | 6291fe2abce4689d6ee7cbaea16692c79bf0d01b (diff) |
spi: make spi_board_info.modalias a char array
Currently, 'modalias' in the spi_device structure is a 'const char *'.
The spi_new_device() function fills in the modalias value from a passed in
spi_board_info data block. Since it is a pointer copy, the new spi_device
remains dependent on the spi_board_info structure after the new spi_device
is registered (no other fields in spi_device directly depend on the
spi_board_info structure; all of the other data is copied).
This causes a problem when dynamically propulating the list of attached
SPI devices. For example, in arch/powerpc, the list of SPI devices can be
populated from data in the device tree. With the current code, the device
tree adapter must kmalloc() a new spi_board_info structure for each new
SPI device it finds in the device tree, and there is no simple mechanism
in place for keeping track of these allocations.
This patch changes modalias from a 'const char *' to a fixed char array.
By copying the modalias string instead of referencing it, the dependency
on the spi_board_info structure is eliminated and an outside caller does
not need to maintain a separate spi_board_info allocation for each device.
If searched through the code to the best of my ability for any references
to modalias which may be affected by this change and haven't found
anything. It has been tested with the lite5200b platform in arch/powerpc.
[dbrownell@users.sourceforge.net: cope with linux-next changes: KOBJ_NAME_LEN obliterated, etc]
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include/linux')
-rw-r--r-- | include/linux/spi/spi.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h index b9a76c972084..a9cc29d46653 100644 --- a/include/linux/spi/spi.h +++ b/include/linux/spi/spi.h | |||
@@ -82,7 +82,7 @@ struct spi_device { | |||
82 | int irq; | 82 | int irq; |
83 | void *controller_state; | 83 | void *controller_state; |
84 | void *controller_data; | 84 | void *controller_data; |
85 | const char *modalias; | 85 | char modalias[32]; |
86 | 86 | ||
87 | /* | 87 | /* |
88 | * likely need more hooks for more protocol options affecting how | 88 | * likely need more hooks for more protocol options affecting how |