Commit 92118c739df879497b8cc5a2eb3a9dc255f01b20
Exists in
master
and in
4 other branches
Merge master.kernel.org:/pub/scm/linux/kernel/git/gregkh/driver-2.6
Showing 16 changed files Side-by-side Diff
- Documentation/spi/butterfly
- drivers/base/base.h
- drivers/base/power/resume.c
- drivers/base/power/shutdown.c
- drivers/base/power/suspend.c
- drivers/base/power/sysfs.c
- drivers/base/sys.c
- drivers/char/drm/drmP.h
- drivers/char/drm/drm_stub.c
- drivers/char/drm/drm_sysfs.c
- drivers/infiniband/core/ucm.c
- drivers/spi/Kconfig
- drivers/spi/spi_butterfly.c
- fs/debugfs/file.c
- lib/kobject.c
- lib/kobject_uevent.c
Documentation/spi/butterfly
| ... | ... | @@ -12,13 +12,20 @@ |
| 12 | 12 | directly to the Butterfly. Or (if you have the parts and skills) you |
| 13 | 13 | can come up with something fancier, providing ciruit protection to the |
| 14 | 14 | Butterfly and the printer port, or with a better power supply than two |
| 15 | -signal pins from the printer port. | |
| 15 | +signal pins from the printer port. Or for that matter, you can use | |
| 16 | +similar cables to talk to many AVR boards, even a breadboard. | |
| 16 | 17 | |
| 18 | +This is more powerful than "ISP programming" cables since it lets kernel | |
| 19 | +SPI protocol drivers interact with the AVR, and could even let the AVR | |
| 20 | +issue interrupts to them. Later, your protocol driver should work | |
| 21 | +easily with a "real SPI controller", instead of this bitbanger. | |
| 17 | 22 | |
| 23 | + | |
| 18 | 24 | The first cable connections will hook Linux up to one SPI bus, with the |
| 19 | 25 | AVR and a DataFlash chip; and to the AVR reset line. This is all you |
| 20 | 26 | need to reflash the firmware, and the pins are the standard Atmel "ISP" |
| 21 | -connector pins (used also on non-Butterfly AVR boards). | |
| 27 | +connector pins (used also on non-Butterfly AVR boards). On the parport | |
| 28 | +side this is like "sp12" programming cables. | |
| 22 | 29 | |
| 23 | 30 | Signal Butterfly Parport (DB-25) |
| 24 | 31 | ------ --------- --------------- |
| ... | ... | @@ -40,10 +47,14 @@ |
| 40 | 47 | SELECT = J400.PB0/nSS = pin 17/C3,nSELECT |
| 41 | 48 | GND = J400.GND = pin 24/GND |
| 42 | 49 | |
| 43 | -The "USI" controller, using J405, can be used for a second SPI bus. That | |
| 44 | -would let you talk to the AVR over SPI, running firmware that makes it act | |
| 45 | -as an SPI slave, while letting either Linux or the AVR use the DataFlash. | |
| 46 | -There are plenty of spare parport pins to wire this one up, such as: | |
| 50 | +Or you could flash firmware making the AVR into an SPI slave (keeping the | |
| 51 | +DataFlash in reset) and tweak the spi_butterfly driver to make it bind to | |
| 52 | +the driver for your custom SPI-based protocol. | |
| 53 | + | |
| 54 | +The "USI" controller, using J405, can also be used for a second SPI bus. | |
| 55 | +That would let you talk to the AVR using custom SPI-with-USI firmware, | |
| 56 | +while letting either Linux or the AVR use the DataFlash. There are plenty | |
| 57 | +of spare parport pins to wire this one up, such as: | |
| 47 | 58 | |
| 48 | 59 | Signal Butterfly Parport (DB-25) |
| 49 | 60 | ------ --------- --------------- |
drivers/base/base.h
| ... | ... | @@ -19,6 +19,10 @@ |
| 19 | 19 | extern void driver_detach(struct device_driver * drv); |
| 20 | 20 | extern int driver_probe_device(struct device_driver *, struct device *); |
| 21 | 21 | |
| 22 | +extern void sysdev_shutdown(void); | |
| 23 | +extern int sysdev_suspend(pm_message_t state); | |
| 24 | +extern int sysdev_resume(void); | |
| 25 | + | |
| 22 | 26 | static inline struct class_device *to_class_dev(struct kobject *obj) |
| 23 | 27 | { |
| 24 | 28 | return container_of(obj, struct class_device, kobj); |
drivers/base/power/resume.c
drivers/base/power/shutdown.c
| ... | ... | @@ -12,6 +12,7 @@ |
| 12 | 12 | #include <linux/device.h> |
| 13 | 13 | #include <asm/semaphore.h> |
| 14 | 14 | |
| 15 | +#include "../base.h" | |
| 15 | 16 | #include "power.h" |
| 16 | 17 | |
| 17 | 18 | #define to_dev(node) container_of(node, struct device, kobj.entry) |
| ... | ... | @@ -28,7 +29,6 @@ |
| 28 | 29 | * they only get one called once when interrupts are disabled. |
| 29 | 30 | */ |
| 30 | 31 | |
| 31 | -extern int sysdev_shutdown(void); | |
| 32 | 32 | |
| 33 | 33 | /** |
| 34 | 34 | * device_shutdown - call ->shutdown() on each device to shutdown. |
drivers/base/power/suspend.c
drivers/base/power/sysfs.c
| ... | ... | @@ -27,22 +27,30 @@ |
| 27 | 27 | |
| 28 | 28 | static ssize_t state_show(struct device * dev, struct device_attribute *attr, char * buf) |
| 29 | 29 | { |
| 30 | - return sprintf(buf, "%u\n", dev->power.power_state.event); | |
| 30 | + if (dev->power.power_state.event) | |
| 31 | + return sprintf(buf, "2\n"); | |
| 32 | + else | |
| 33 | + return sprintf(buf, "0\n"); | |
| 31 | 34 | } |
| 32 | 35 | |
| 33 | 36 | static ssize_t state_store(struct device * dev, struct device_attribute *attr, const char * buf, size_t n) |
| 34 | 37 | { |
| 35 | 38 | pm_message_t state; |
| 36 | - char * rest; | |
| 37 | - int error = 0; | |
| 39 | + int error = -EINVAL; | |
| 38 | 40 | |
| 39 | - state.event = simple_strtoul(buf, &rest, 10); | |
| 40 | - if (*rest) | |
| 41 | - return -EINVAL; | |
| 42 | - if (state.event) | |
| 41 | + state.event = PM_EVENT_SUSPEND; | |
| 42 | + /* Older apps expected to write "3" here - confused with PCI D3 */ | |
| 43 | + if ((n == 1) && !strcmp(buf, "3")) | |
| 43 | 44 | error = dpm_runtime_suspend(dev, state); |
| 44 | - else | |
| 45 | + | |
| 46 | + if ((n == 1) && !strcmp(buf, "2")) | |
| 47 | + error = dpm_runtime_suspend(dev, state); | |
| 48 | + | |
| 49 | + if ((n == 1) && !strcmp(buf, "0")) { | |
| 45 | 50 | dpm_runtime_resume(dev); |
| 51 | + error = 0; | |
| 52 | + } | |
| 53 | + | |
| 46 | 54 | return error ? error : n; |
| 47 | 55 | } |
| 48 | 56 |
drivers/base/sys.c
drivers/char/drm/drmP.h
| ... | ... | @@ -980,7 +980,7 @@ |
| 980 | 980 | extern unsigned int drm_debug; |
| 981 | 981 | extern unsigned int drm_cards_limit; |
| 982 | 982 | extern drm_head_t **drm_heads; |
| 983 | -extern struct drm_sysfs_class *drm_class; | |
| 983 | +extern struct class *drm_class; | |
| 984 | 984 | extern struct proc_dir_entry *drm_proc_root; |
| 985 | 985 | |
| 986 | 986 | /* Proc support (drm_proc.h) */ |
| ... | ... | @@ -1011,11 +1011,9 @@ |
| 1011 | 1011 | extern void drm_pci_free(drm_device_t * dev, drm_dma_handle_t * dmah); |
| 1012 | 1012 | |
| 1013 | 1013 | /* sysfs support (drm_sysfs.c) */ |
| 1014 | -struct drm_sysfs_class; | |
| 1015 | -extern struct drm_sysfs_class *drm_sysfs_create(struct module *owner, | |
| 1016 | - char *name); | |
| 1017 | -extern void drm_sysfs_destroy(struct drm_sysfs_class *cs); | |
| 1018 | -extern struct class_device *drm_sysfs_device_add(struct drm_sysfs_class *cs, | |
| 1014 | +extern struct class *drm_sysfs_create(struct module *owner, char *name); | |
| 1015 | +extern void drm_sysfs_destroy(struct class *cs); | |
| 1016 | +extern struct class_device *drm_sysfs_device_add(struct class *cs, | |
| 1019 | 1017 | drm_head_t *head); |
| 1020 | 1018 | extern void drm_sysfs_device_remove(struct class_device *class_dev); |
| 1021 | 1019 |
drivers/char/drm/drm_stub.c
| ... | ... | @@ -50,7 +50,7 @@ |
| 50 | 50 | module_param_named(debug, drm_debug, int, 0600); |
| 51 | 51 | |
| 52 | 52 | drm_head_t **drm_heads; |
| 53 | -struct drm_sysfs_class *drm_class; | |
| 53 | +struct class *drm_class; | |
| 54 | 54 | struct proc_dir_entry *drm_proc_root; |
| 55 | 55 | |
| 56 | 56 | static int drm_fill_in_dev(drm_device_t * dev, struct pci_dev *pdev, |
drivers/char/drm/drm_sysfs.c
| 1 | + | |
| 1 | 2 | /* |
| 2 | 3 | * drm_sysfs.c - Modifications to drm_sysfs_class.c to support |
| 3 | 4 | * extra sysfs attribute from DRM. Normal drm_sysfs_class |
| ... | ... | @@ -19,36 +20,6 @@ |
| 19 | 20 | #include "drm_core.h" |
| 20 | 21 | #include "drmP.h" |
| 21 | 22 | |
| 22 | -struct drm_sysfs_class { | |
| 23 | - struct class_device_attribute attr; | |
| 24 | - struct class class; | |
| 25 | -}; | |
| 26 | -#define to_drm_sysfs_class(d) container_of(d, struct drm_sysfs_class, class) | |
| 27 | - | |
| 28 | -struct simple_dev { | |
| 29 | - dev_t dev; | |
| 30 | - struct class_device class_dev; | |
| 31 | -}; | |
| 32 | -#define to_simple_dev(d) container_of(d, struct simple_dev, class_dev) | |
| 33 | - | |
| 34 | -static void release_simple_dev(struct class_device *class_dev) | |
| 35 | -{ | |
| 36 | - struct simple_dev *s_dev = to_simple_dev(class_dev); | |
| 37 | - kfree(s_dev); | |
| 38 | -} | |
| 39 | - | |
| 40 | -static ssize_t show_dev(struct class_device *class_dev, char *buf) | |
| 41 | -{ | |
| 42 | - struct simple_dev *s_dev = to_simple_dev(class_dev); | |
| 43 | - return print_dev_t(buf, s_dev->dev); | |
| 44 | -} | |
| 45 | - | |
| 46 | -static void drm_sysfs_class_release(struct class *class) | |
| 47 | -{ | |
| 48 | - struct drm_sysfs_class *cs = to_drm_sysfs_class(class); | |
| 49 | - kfree(cs); | |
| 50 | -} | |
| 51 | - | |
| 52 | 23 | /* Display the version of drm_core. This doesn't work right in current design */ |
| 53 | 24 | static ssize_t version_show(struct class *dev, char *buf) |
| 54 | 25 | { |
| 55 | 26 | |
| 56 | 27 | |
| 57 | 28 | |
| ... | ... | @@ -69,38 +40,16 @@ |
| 69 | 40 | * Note, the pointer created here is to be destroyed when finished by making a |
| 70 | 41 | * call to drm_sysfs_destroy(). |
| 71 | 42 | */ |
| 72 | -struct drm_sysfs_class *drm_sysfs_create(struct module *owner, char *name) | |
| 43 | +struct class *drm_sysfs_create(struct module *owner, char *name) | |
| 73 | 44 | { |
| 74 | - struct drm_sysfs_class *cs; | |
| 75 | - int retval; | |
| 45 | + struct class *class; | |
| 76 | 46 | |
| 77 | - cs = kmalloc(sizeof(*cs), GFP_KERNEL); | |
| 78 | - if (!cs) { | |
| 79 | - retval = -ENOMEM; | |
| 80 | - goto error; | |
| 81 | - } | |
| 82 | - memset(cs, 0x00, sizeof(*cs)); | |
| 47 | + class = class_create(owner, name); | |
| 48 | + if (!class) | |
| 49 | + return class; | |
| 83 | 50 | |
| 84 | - cs->class.name = name; | |
| 85 | - cs->class.class_release = drm_sysfs_class_release; | |
| 86 | - cs->class.release = release_simple_dev; | |
| 87 | - | |
| 88 | - cs->attr.attr.name = "dev"; | |
| 89 | - cs->attr.attr.mode = S_IRUGO; | |
| 90 | - cs->attr.attr.owner = owner; | |
| 91 | - cs->attr.show = show_dev; | |
| 92 | - cs->attr.store = NULL; | |
| 93 | - | |
| 94 | - retval = class_register(&cs->class); | |
| 95 | - if (retval) | |
| 96 | - goto error; | |
| 97 | - class_create_file(&cs->class, &class_attr_version); | |
| 98 | - | |
| 99 | - return cs; | |
| 100 | - | |
| 101 | - error: | |
| 102 | - kfree(cs); | |
| 103 | - return ERR_PTR(retval); | |
| 51 | + class_create_file(class, &class_attr_version); | |
| 52 | + return class; | |
| 104 | 53 | } |
| 105 | 54 | |
| 106 | 55 | /** |
| 107 | 56 | |
| 108 | 57 | |
| ... | ... | @@ -110,12 +59,13 @@ |
| 110 | 59 | * Note, the pointer to be destroyed must have been created with a call to |
| 111 | 60 | * drm_sysfs_create(). |
| 112 | 61 | */ |
| 113 | -void drm_sysfs_destroy(struct drm_sysfs_class *cs) | |
| 62 | +void drm_sysfs_destroy(struct class *class) | |
| 114 | 63 | { |
| 115 | - if ((cs == NULL) || (IS_ERR(cs))) | |
| 64 | + if ((class == NULL) || (IS_ERR(class))) | |
| 116 | 65 | return; |
| 117 | 66 | |
| 118 | - class_unregister(&cs->class); | |
| 67 | + class_remove_file(class, &class_attr_version); | |
| 68 | + class_destroy(class); | |
| 119 | 69 | } |
| 120 | 70 | |
| 121 | 71 | static ssize_t show_dri(struct class_device *class_device, char *buf) |
| ... | ... | @@ -132,7 +82,7 @@ |
| 132 | 82 | |
| 133 | 83 | /** |
| 134 | 84 | * drm_sysfs_device_add - adds a class device to sysfs for a character driver |
| 135 | - * @cs: pointer to the struct drm_sysfs_class that this device should be registered to. | |
| 85 | + * @cs: pointer to the struct class that this device should be registered to. | |
| 136 | 86 | * @dev: the dev_t for the device to be added. |
| 137 | 87 | * @device: a pointer to a struct device that is assiociated with this class device. |
| 138 | 88 | * @fmt: string for the class device's name |
| 139 | 89 | |
| 140 | 90 | |
| 141 | 91 | |
| 142 | 92 | |
| 143 | 93 | |
| 144 | 94 | |
| ... | ... | @@ -141,46 +91,26 @@ |
| 141 | 91 | * class. A "dev" file will be created, showing the dev_t for the device. The |
| 142 | 92 | * pointer to the struct class_device will be returned from the call. Any further |
| 143 | 93 | * sysfs files that might be required can be created using this pointer. |
| 144 | - * Note: the struct drm_sysfs_class passed to this function must have previously been | |
| 94 | + * Note: the struct class passed to this function must have previously been | |
| 145 | 95 | * created with a call to drm_sysfs_create(). |
| 146 | 96 | */ |
| 147 | -struct class_device *drm_sysfs_device_add(struct drm_sysfs_class *cs, | |
| 148 | - drm_head_t *head) | |
| 97 | +struct class_device *drm_sysfs_device_add(struct class *cs, drm_head_t *head) | |
| 149 | 98 | { |
| 150 | - struct simple_dev *s_dev = NULL; | |
| 151 | - int i, retval; | |
| 99 | + struct class_device *class_dev; | |
| 100 | + int i; | |
| 152 | 101 | |
| 153 | - if ((cs == NULL) || (IS_ERR(cs))) { | |
| 154 | - retval = -ENODEV; | |
| 155 | - goto error; | |
| 156 | - } | |
| 102 | + class_dev = class_device_create(cs, NULL, | |
| 103 | + MKDEV(DRM_MAJOR, head->minor), | |
| 104 | + &(head->dev->pdev)->dev, | |
| 105 | + "card%d", head->minor); | |
| 106 | + if (!class_dev) | |
| 107 | + return NULL; | |
| 157 | 108 | |
| 158 | - s_dev = kmalloc(sizeof(*s_dev), GFP_KERNEL); | |
| 159 | - if (!s_dev) { | |
| 160 | - retval = -ENOMEM; | |
| 161 | - goto error; | |
| 162 | - } | |
| 163 | - memset(s_dev, 0x00, sizeof(*s_dev)); | |
| 109 | + class_set_devdata(class_dev, head); | |
| 164 | 110 | |
| 165 | - s_dev->dev = MKDEV(DRM_MAJOR, head->minor); | |
| 166 | - s_dev->class_dev.dev = &(head->dev->pdev)->dev; | |
| 167 | - s_dev->class_dev.class = &cs->class; | |
| 168 | - | |
| 169 | - snprintf(s_dev->class_dev.class_id, BUS_ID_SIZE, "card%d", head->minor); | |
| 170 | - retval = class_device_register(&s_dev->class_dev); | |
| 171 | - if (retval) | |
| 172 | - goto error; | |
| 173 | - | |
| 174 | - class_device_create_file(&s_dev->class_dev, &cs->attr); | |
| 175 | - class_set_devdata(&s_dev->class_dev, head); | |
| 176 | - | |
| 177 | 111 | for (i = 0; i < ARRAY_SIZE(class_device_attrs); i++) |
| 178 | - class_device_create_file(&s_dev->class_dev, &class_device_attrs[i]); | |
| 179 | - return &s_dev->class_dev; | |
| 180 | - | |
| 181 | -error: | |
| 182 | - kfree(s_dev); | |
| 183 | - return ERR_PTR(retval); | |
| 112 | + class_device_create_file(class_dev, &class_device_attrs[i]); | |
| 113 | + return class_dev; | |
| 184 | 114 | } |
| 185 | 115 | |
| 186 | 116 | /** |
| 187 | 117 | |
| ... | ... | @@ -192,11 +122,10 @@ |
| 192 | 122 | */ |
| 193 | 123 | void drm_sysfs_device_remove(struct class_device *class_dev) |
| 194 | 124 | { |
| 195 | - struct simple_dev *s_dev = to_simple_dev(class_dev); | |
| 196 | 125 | int i; |
| 197 | 126 | |
| 198 | 127 | for (i = 0; i < ARRAY_SIZE(class_device_attrs); i++) |
| 199 | - class_device_remove_file(&s_dev->class_dev, &class_device_attrs[i]); | |
| 200 | - class_device_unregister(&s_dev->class_dev); | |
| 128 | + class_device_remove_file(class_dev, &class_device_attrs[i]); | |
| 129 | + class_device_unregister(class_dev); | |
| 201 | 130 | } |
drivers/infiniband/core/ucm.c
| ... | ... | @@ -1319,15 +1319,6 @@ |
| 1319 | 1319 | .release = ib_ucm_release_class_dev |
| 1320 | 1320 | }; |
| 1321 | 1321 | |
| 1322 | -static ssize_t show_dev(struct class_device *class_dev, char *buf) | |
| 1323 | -{ | |
| 1324 | - struct ib_ucm_device *dev; | |
| 1325 | - | |
| 1326 | - dev = container_of(class_dev, struct ib_ucm_device, class_dev); | |
| 1327 | - return print_dev_t(buf, dev->dev.dev); | |
| 1328 | -} | |
| 1329 | -static CLASS_DEVICE_ATTR(dev, S_IRUGO, show_dev, NULL); | |
| 1330 | - | |
| 1331 | 1322 | static ssize_t show_ibdev(struct class_device *class_dev, char *buf) |
| 1332 | 1323 | { |
| 1333 | 1324 | struct ib_ucm_device *dev; |
| 1334 | 1325 | |
| ... | ... | @@ -1364,14 +1355,12 @@ |
| 1364 | 1355 | |
| 1365 | 1356 | ucm_dev->class_dev.class = &ucm_class; |
| 1366 | 1357 | ucm_dev->class_dev.dev = device->dma_device; |
| 1358 | + ucm_dev->class_dev.devt = ucm_dev->dev.dev; | |
| 1367 | 1359 | snprintf(ucm_dev->class_dev.class_id, BUS_ID_SIZE, "ucm%d", |
| 1368 | 1360 | ucm_dev->devnum); |
| 1369 | 1361 | if (class_device_register(&ucm_dev->class_dev)) |
| 1370 | 1362 | goto err_cdev; |
| 1371 | 1363 | |
| 1372 | - if (class_device_create_file(&ucm_dev->class_dev, | |
| 1373 | - &class_device_attr_dev)) | |
| 1374 | - goto err_class; | |
| 1375 | 1364 | if (class_device_create_file(&ucm_dev->class_dev, |
| 1376 | 1365 | &class_device_attr_ibdev)) |
| 1377 | 1366 | goto err_class; |
drivers/spi/Kconfig
| ... | ... | @@ -75,16 +75,6 @@ |
| 75 | 75 | inexpensive battery powered microcontroller evaluation board. |
| 76 | 76 | This same cable can be used to flash new firmware. |
| 77 | 77 | |
| 78 | -config SPI_BUTTERFLY | |
| 79 | - tristate "Parallel port adapter for AVR Butterfly (DEVELOPMENT)" | |
| 80 | - depends on SPI_MASTER && PARPORT && EXPERIMENTAL | |
| 81 | - select SPI_BITBANG | |
| 82 | - help | |
| 83 | - This uses a custom parallel port cable to connect to an AVR | |
| 84 | - Butterfly <http://www.atmel.com/products/avr/butterfly>, an | |
| 85 | - inexpensive battery powered microcontroller evaluation board. | |
| 86 | - This same cable can be used to flash new firmware. | |
| 87 | - | |
| 88 | 78 | # |
| 89 | 79 | # Add new SPI master controllers in alphabetical order above this line |
| 90 | 80 | # |
drivers/spi/spi_butterfly.c
| ... | ... | @@ -163,21 +163,20 @@ |
| 163 | 163 | struct butterfly *pp = spidev_to_pp(spi); |
| 164 | 164 | |
| 165 | 165 | /* set default clock polarity */ |
| 166 | - if (value) | |
| 166 | + if (value != BITBANG_CS_INACTIVE) | |
| 167 | 167 | setsck(spi, spi->mode & SPI_CPOL); |
| 168 | 168 | |
| 169 | 169 | /* no chipselect on this USI link config */ |
| 170 | 170 | if (is_usidev(spi)) |
| 171 | 171 | return; |
| 172 | 172 | |
| 173 | - /* here, value == "activate or not" */ | |
| 174 | - | |
| 175 | - /* most PARPORT_CONTROL_* bits are negated */ | |
| 173 | + /* here, value == "activate or not"; | |
| 174 | + * most PARPORT_CONTROL_* bits are negated, so we must | |
| 175 | + * morph it to value == "bit value to write in control register" | |
| 176 | + */ | |
| 176 | 177 | if (spi_cs_bit == PARPORT_CONTROL_INIT) |
| 177 | 178 | value = !value; |
| 178 | 179 | |
| 179 | - /* here, value == "bit value to write in control register" */ | |
| 180 | - | |
| 181 | 180 | parport_frob_control(pp->port, spi_cs_bit, value ? spi_cs_bit : 0); |
| 182 | 181 | } |
| 183 | 182 | |
| ... | ... | @@ -202,7 +201,9 @@ |
| 202 | 201 | |
| 203 | 202 | /* override default partitioning with cmdlinepart */ |
| 204 | 203 | static struct mtd_partition partitions[] = { { |
| 205 | - /* JFFS2 wants partitions of 4*N blocks for this device ... */ | |
| 204 | + /* JFFS2 wants partitions of 4*N blocks for this device, | |
| 205 | + * so sectors 0 and 1 can't be partitions by themselves. | |
| 206 | + */ | |
| 206 | 207 | |
| 207 | 208 | /* sector 0 = 8 pages * 264 bytes/page (1 block) |
| 208 | 209 | * sector 1 = 248 pages * 264 bytes/page |
| ... | ... | @@ -316,8 +317,9 @@ |
| 316 | 317 | if (status < 0) |
| 317 | 318 | goto clean2; |
| 318 | 319 | |
| 319 | - /* Bus 1 lets us talk to at45db041b (firmware disables AVR) | |
| 320 | - * or AVR (firmware resets at45, acts as spi slave) | |
| 320 | + /* Bus 1 lets us talk to at45db041b (firmware disables AVR SPI), AVR | |
| 321 | + * (firmware resets at45, acts as spi slave) or neither (we ignore | |
| 322 | + * both, AVR uses AT45). Here we expect firmware for the first option. | |
| 321 | 323 | */ |
| 322 | 324 | pp->info[0].max_speed_hz = 15 * 1000 * 1000; |
| 323 | 325 | strcpy(pp->info[0].modalias, "mtd_dataflash"); |
| ... | ... | @@ -330,7 +332,9 @@ |
| 330 | 332 | pp->dataflash->dev.bus_id); |
| 331 | 333 | |
| 332 | 334 | #ifdef HAVE_USI |
| 333 | - /* even more custom AVR firmware */ | |
| 335 | + /* Bus 2 is only for talking to the AVR, and it can work no | |
| 336 | + * matter who masters bus 1; needs appropriate AVR firmware. | |
| 337 | + */ | |
| 334 | 338 | pp->info[1].max_speed_hz = 10 /* ?? */ * 1000 * 1000; |
| 335 | 339 | strcpy(pp->info[1].modalias, "butterfly"); |
| 336 | 340 | // pp->info[1].platform_data = ... TBD ... ; |
| ... | ... | @@ -378,13 +382,8 @@ |
| 378 | 382 | pp = butterfly; |
| 379 | 383 | butterfly = NULL; |
| 380 | 384 | |
| 381 | -#ifdef HAVE_USI | |
| 382 | - spi_unregister_device(pp->butterfly); | |
| 383 | - pp->butterfly = NULL; | |
| 384 | -#endif | |
| 385 | - spi_unregister_device(pp->dataflash); | |
| 386 | - pp->dataflash = NULL; | |
| 387 | - | |
| 385 | + /* stop() unregisters child devices too */ | |
| 386 | + pdev = to_platform_device(pp->bitbang.master->cdev.dev); | |
| 388 | 387 | status = spi_bitbang_stop(&pp->bitbang); |
| 389 | 388 | |
| 390 | 389 | /* turn off VCC */ |
| ... | ... | @@ -394,8 +393,6 @@ |
| 394 | 393 | parport_release(pp->pd); |
| 395 | 394 | parport_unregister_device(pp->pd); |
| 396 | 395 | |
| 397 | - pdev = to_platform_device(pp->bitbang.master->cdev.dev); | |
| 398 | - | |
| 399 | 396 | (void) spi_master_put(pp->bitbang.master); |
| 400 | 397 | |
| 401 | 398 | platform_device_unregister(pdev); |
| ... | ... | @@ -420,5 +417,6 @@ |
| 420 | 417 | } |
| 421 | 418 | module_exit(butterfly_exit); |
| 422 | 419 | |
| 420 | +MODULE_DESCRIPTION("Parport Adapter driver for AVR Butterfly"); | |
| 423 | 421 | MODULE_LICENSE("GPL"); |
fs/debugfs/file.c
| ... | ... | @@ -56,7 +56,7 @@ |
| 56 | 56 | DEFINE_SIMPLE_ATTRIBUTE(fops_u8, debugfs_u8_get, debugfs_u8_set, "%llu\n"); |
| 57 | 57 | |
| 58 | 58 | /** |
| 59 | - * debugfs_create_u8 - create a file in the debugfs filesystem that is used to read and write a unsigned 8 bit value. | |
| 59 | + * debugfs_create_u8 - create a file in the debugfs filesystem that is used to read and write an unsigned 8 bit value. | |
| 60 | 60 | * |
| 61 | 61 | * @name: a pointer to a string containing the name of the file to create. |
| 62 | 62 | * @mode: the permission that the file should have |
| ... | ... | @@ -98,7 +98,7 @@ |
| 98 | 98 | DEFINE_SIMPLE_ATTRIBUTE(fops_u16, debugfs_u16_get, debugfs_u16_set, "%llu\n"); |
| 99 | 99 | |
| 100 | 100 | /** |
| 101 | - * debugfs_create_u16 - create a file in the debugfs filesystem that is used to read and write a unsigned 8 bit value. | |
| 101 | + * debugfs_create_u16 - create a file in the debugfs filesystem that is used to read and write an unsigned 16 bit value. | |
| 102 | 102 | * |
| 103 | 103 | * @name: a pointer to a string containing the name of the file to create. |
| 104 | 104 | * @mode: the permission that the file should have |
| ... | ... | @@ -140,7 +140,7 @@ |
| 140 | 140 | DEFINE_SIMPLE_ATTRIBUTE(fops_u32, debugfs_u32_get, debugfs_u32_set, "%llu\n"); |
| 141 | 141 | |
| 142 | 142 | /** |
| 143 | - * debugfs_create_u32 - create a file in the debugfs filesystem that is used to read and write a unsigned 8 bit value. | |
| 143 | + * debugfs_create_u32 - create a file in the debugfs filesystem that is used to read and write an unsigned 32 bit value. | |
| 144 | 144 | * |
| 145 | 145 | * @name: a pointer to a string containing the name of the file to create. |
| 146 | 146 | * @mode: the permission that the file should have |
lib/kobject.c
| ... | ... | @@ -72,6 +72,8 @@ |
| 72 | 72 | * Add 1 to strlen for leading '/' of each level. |
| 73 | 73 | */ |
| 74 | 74 | do { |
| 75 | + if (kobject_name(parent) == NULL) | |
| 76 | + return 0; | |
| 75 | 77 | length += strlen(kobject_name(parent)) + 1; |
| 76 | 78 | parent = parent->parent; |
| 77 | 79 | } while (parent); |
| ... | ... | @@ -107,6 +109,8 @@ |
| 107 | 109 | int len; |
| 108 | 110 | |
| 109 | 111 | len = get_kobj_path_length(kobj); |
| 112 | + if (len == 0) | |
| 113 | + return NULL; | |
| 110 | 114 | path = kmalloc(len, gfp_mask); |
| 111 | 115 | if (!path) |
| 112 | 116 | return NULL; |
| ... | ... | @@ -162,6 +166,11 @@ |
| 162 | 166 | return -ENOENT; |
| 163 | 167 | if (!kobj->k_name) |
| 164 | 168 | kobj->k_name = kobj->name; |
| 169 | + if (!kobj->k_name) { | |
| 170 | + pr_debug("kobject attempted to be registered with no name!\n"); | |
| 171 | + WARN_ON(1); | |
| 172 | + return -EINVAL; | |
| 173 | + } | |
| 165 | 174 | parent = kobject_get(kobj->parent); |
| 166 | 175 | |
| 167 | 176 | pr_debug("kobject %s: registering. parent: %s, set: %s\n", |
lib/kobject_uevent.c
| ... | ... | @@ -22,7 +22,7 @@ |
| 22 | 22 | #include <linux/kobject.h> |
| 23 | 23 | #include <net/sock.h> |
| 24 | 24 | |
| 25 | -#define BUFFER_SIZE 1024 /* buffer for the variables */ | |
| 25 | +#define BUFFER_SIZE 2048 /* buffer for the variables */ | |
| 26 | 26 | #define NUM_ENVP 32 /* number of env pointers */ |
| 27 | 27 | |
| 28 | 28 | #if defined(CONFIG_HOTPLUG) && defined(CONFIG_NET) |