aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/firewire/core-device.c (follow)
AgeCommit message (Collapse)AuthorFilesLines
2010-08-02Merge firewire branches to be released post v2.6.35Stefan Richter1-5/+6
Conflicts: drivers/firewire/core-card.c drivers/firewire/core-cdev.c and forgotten #include <linux/time.h> in drivers/firewire/ohci.c Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
2010-07-13firewire: cdev: fix fw_cdev_event_bus_reset emission after local config ROM changesStefan Richter1-0/+1
When a descriptor was added or removed to the local node's config ROM, userspace clients which had a local node's /dev/fw* open did not receive any fw_cdev_event_bus_reset for poll()/read() consumption. The cause was that the core-device.c facility which re-reads the config ROM of the bus reset initiator node missed to call the fw_device update function. The fw_units are destroyed and newly added, but their parent stays and needs to be updated. Reported-by: Jay Fenlason <fenlason@redhat.com> Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
2010-07-13firewire: core: fix fw_send_request kerneldoc commentStefan Richter1-5/+5
The present inline documentation of the fw_send_request() in-kernel API refers to userland code that is not applicable to kernel drivers at all. Reported-by: Ben Gamari <bgamari.foss@gmail.com> While we are at fixing the whole documentation of fw_send_request(), also improve the rest of firewire-core's kerneldoc comments: - Add a bit of text concerning fw_run_transaction()'s call parameters. - Append () to function names and tab-align parameter descriptions as suggested by the example in Documentation/kernel-doc-nano-HOWTO.txt. - Remove kerneldoc markers from comments on static functions. - Remove outdated parameter descriptions at build_tree(). Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
2010-03-30include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.hTejun Heo1-0/+1
percpu.h is included by sched.h and module.h and thus ends up being included when building most .c files. percpu.h includes slab.h which in turn includes gfp.h making everything defined by the two files universally available and complicating inclusion dependencies. percpu.h -> slab.h dependency is about to be removed. Prepare for this change by updating users of gfp and slab facilities include those headers directly instead of assuming availability. As this conversion needs to touch large number of source files, the following script is used as the basis of conversion. http://userweb.kernel.org/~tj/misc/slabh-sweep.py The script does the followings. * Scan files for gfp and slab usages and update includes such that only the necessary includes are there. ie. if only gfp is used, gfp.h, if slab is used, slab.h. * When the script inserts a new include, it looks at the include blocks and try to put the new include such that its order conforms to its surrounding. It's put in the include block which contains core kernel includes, in the same order that the rest are ordered - alphabetical, Christmas tree, rev-Xmas-tree or at the end if there doesn't seem to be any matching order. * If the script can't find a place to put a new include (mostly because the file doesn't have fitting include block), it prints out an error message indicating which .h file needs to be added to the file. The conversion was done in the following steps. 1. The initial automatic conversion of all .c files updated slightly over 4000 files, deleting around 700 includes and adding ~480 gfp.h and ~3000 slab.h inclusions. The script emitted errors for ~400 files. 2. Each error was manually checked. Some didn't need the inclusion, some needed manual addition while adding it to implementation .h or embedding .c file was more appropriate for others. This step added inclusions to around 150 files. 3. The script was run again and the output was compared to the edits from #2 to make sure no file was left behind. 4. Several build tests were done and a couple of problems were fixed. e.g. lib/decompress_*.c used malloc/free() wrappers around slab APIs requiring slab.h to be added manually. 5. The script was run on all .h files but without automatically editing them as sprinkling gfp.h and slab.h inclusions around .h files could easily lead to inclusion dependency hell. Most gfp.h inclusion directives were ignored as stuff from gfp.h was usually wildly available and often used in preprocessor macros. Each slab.h inclusion directive was examined and added manually as necessary. 6. percpu.h was updated not to include slab.h. 7. Build test were done on the following configurations and failures were fixed. CONFIG_GCOV_KERNEL was turned off for all tests (as my distributed build env didn't work with gcov compiles) and a few more options had to be turned off depending on archs to make things build (like ipr on powerpc/64 which failed due to missing writeq). * x86 and x86_64 UP and SMP allmodconfig and a custom test config. * powerpc and powerpc64 SMP allmodconfig * sparc and sparc64 SMP allmodconfig * ia64 SMP allmodconfig * s390 SMP allmodconfig * alpha SMP allmodconfig * um on x86_64 SMP allmodconfig 8. percpu.h modifications were reverted so that it could be applied as a separate patch and serve as bisection point. Given the fact that I had only a couple of failures from tests on step 6, I'm fairly confident about the coverage of this conversion patch. If there is a breakage, it's likely to be something in one of the arch headers which should be easily discoverable easily on most builds of the specific arch. Signed-off-by: Tejun Heo <tj@kernel.org> Guess-its-ok-by: Christoph Lameter <cl@linux-foundation.org> Cc: Ingo Molnar <mingo@redhat.com> Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com>
2010-03-26Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ieee1394/linux1394-2.6Linus Torvalds1-63/+40
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ieee1394/linux1394-2.6: firewire: core: align driver match with modalias firewire: core: fix Model_ID in modalias firewire: ohci: add cycle timer quirk for the TI TSB12LV22 firewire: core: fw_iso_resource_manage: fix error handling
2010-03-24firewire: core: align driver match with modaliasStefan Richter1-49/+38
The driver match strategy was: - Match vendor/model/specifier/version of the unit directory. - If that was a miss, match vendor from the root directory and model/specifier/version of the unit directory. This was inconsistent with how the modalias string was constructed until recently (take vendor/model from root directory and specifier/ version from unit directory). It was also inconsistent with how it is done since the parent commit: - Use vendor/model/specifier/version of the unit directory if possible, - fall back to one or more of vendor/model/specifier/version from the root directory depending on which ones are not present at the unit directory. Fix this inconsistency by sharing the ROM scanner function between modalias printer function and driver match function. Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
2010-03-24firewire: core: fix Model_ID in modaliasStefan Richter1-26/+14
The modalias string of devices that represent units on a FireWire node did not show Module_ID entries within unit directories. This was because firewire-core searched only the root directory of the configuration ROM for a Model_ID entry. We now search first the root directory, then the unit directory. IOW honor a unit directory's Model_ID if present, otherwise fall back to the root directory's model ID (if present). Furthermore, apply the same change to Vendor_ID. This had the same issue but it was less apparent because most devices provide Vendor_ID only in the root directory. And finally, also use this strategy for the remaining two IDs in the modalias, Specifier_ID and Version. It does not actually make sense to look for them elsewhere than in the unit directory because they are mandatory there. However, a uniform search order simplifies the implementation and has no adverse affect in practice. Side notes: - The older counterpart of this, nodemgr.c of ieee1394, looked for Vendor_ID first in the root directory, then in the unit directory, and for Model_ID only in the unit directory. - There is a single mainline driver which requires Vendor_ID and Model_ID --- the firedtv driver. This one worked because FireDTVs provide Vendor_ID in the root directory and Model_ID identically in root directory and unit directory. - Apart from firedtv, there are currently no drivers known to me (including userspace drivers) that look at the Vendor_ID or Model_ID of the modalias. Reported-by: Maciej Żenczykowski <zenczykowski@gmail.com> Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
2010-03-07Driver core: create lock/unlock functions for struct deviceGreg Kroah-Hartman1-3/+2
In the future, we are going to be changing the lock type for struct device (once we get the lockdep infrastructure properly worked out) To make that changeover easier, and to possibly burry the lock in a different part of struct device, let's create some functions to lock and unlock a device so that no out-of-core code needs to be changed in the future. This patch creates the device_lock/unlock/trylock() functions, and converts all in-tree users to them. Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Jean Delvare <khali@linux-fr.org> Cc: Dave Young <hidave.darkstar@gmail.com> Cc: Ming Lei <tom.leiming@gmail.com> Cc: Jiri Kosina <jkosina@suse.cz> Cc: Phil Carmody <ext-phil.2.carmody@nokia.com> Cc: Arjan van de Ven <arjan@linux.intel.com> Cc: Cornelia Huck <cornelia.huck@de.ibm.com> Cc: Rafael J. Wysocki <rjw@sisk.pl> Cc: Pavel Machek <pavel@ucw.cz> Cc: Len Brown <len.brown@intel.com> Cc: Magnus Damm <damm@igel.co.jp> Cc: Alan Stern <stern@rowland.harvard.edu> Cc: Randy Dunlap <randy.dunlap@oracle.com> Cc: Stefan Richter <stefanr@s5r6.in-berlin.de> Cc: David Brownell <dbrownell@users.sourceforge.net> Cc: Vegard Nossum <vegard.nossum@gmail.com> Cc: Jesse Barnes <jbarnes@virtuousgeek.org> Cc: Alex Chiang <achiang@hp.com> Cc: Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com> Cc: Andrew Morton <akpm@linux-foundation.org> Cc: Andrew Patterson <andrew.patterson@hp.com> Cc: Yu Zhao <yu.zhao@intel.com> Cc: Dominik Brodowski <linux@dominikbrodowski.net> Cc: Samuel Ortiz <sameo@linux.intel.com> Cc: Wolfram Sang <w.sang@pengutronix.de> Cc: CHENG Renquan <rqcheng@smu.edu.sg> Cc: Oliver Neukum <oliver@neukum.org> Cc: Frans Pop <elendil@planet.nl> Cc: David Vrabel <david.vrabel@csr.com> Cc: Kay Sievers <kay.sievers@vrfy.org> Cc: Sarah Sharp <sarah.a.sharp@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2010-02-24firewire: core: rename an internal functionStefan Richter1-14/+14
according to what it really does. Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
2010-02-24firewire: core: fix an information leakStefan Richter1-0/+1
If a device exposes a sparsely populated configuration ROM, firewire-core's sysfs interface and character device file interface showed random data in the gaps between config ROM blocks. Fix this by zero-initialization of the config ROM reader's scratch buffer. Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
2010-02-24firewire: core: increase stack size of config ROM readerStefan Richter1-4/+2
The stack size of 16 was artificially chosen and may be too small in extreme cases. A device won't be accessible then. Since it doesn't really matter to the slab allocator whether we ask for 1088 bytes or 2048 bytes of scratch memory, just allocate 2048 bytes for the sum of temporary config ROM image and stack, and we will never ever overflow the stack (because there simply can't be more stack items than ROM entries). Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
2010-02-24firewire: core: don't fail device creation in case of too large config ROM blocksStefan Richter1-7/+11
It never happened yet, but better safe than sorry: If a device's config ROM contains a block which overlaps the boundary at 0xfffff00007ff, just ignore that one block instead of refusing to add the device representation. That way, upper layers (kernelspace or userspace drivers) might still be able to use the device to some degree. That's better than total inaccessibility of the device. Worse, the core would have logged only a generic "giving up on config rom" message which could only be debugged by feeding a firewire-ohci debug logging session through a config ROM interpreter, IOW would likely remain undiagnosed. Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
2010-02-24firewire: core: fix "giving up on config rom" with Panasonic AG-DV2500Stefan Richter1-10/+22
The Panasonic AG-DV2500 tape deck contains an invalid entry in its configuration ROM root directory: A leaf pointer with the undefined key ID 0 and an offset that points way out of the standard config ROM area. This caused firewire-core to dismiss the device with the generic log message "giving up on config rom for node id...", after which it was of course impossible to access the tape deck with dvgrab or any other program. https://bugzilla.redhat.com/show_bug.cgi?id=449252#c29 The fix is to simply ignore this invalid ROM entry and proceed to read the valid rest of the ROM. There is a catch though: When the kernel later iterates over the ROM, it would be nasty having to check again for such too large ROM offsets. Therefore we manipulate the defective or unsupported ROM entry to become a harmless immediate entry that won't have any side effects later (an entry with the value 0x00000000). Reported-by: George Chriss Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
2009-12-29firewire: qualify config ROM cache pointers as const pointersStefan Richter1-10/+11
Several config ROM related functions only peek at the ROM cache; mark their arguments as const pointers. Ditto fw_device.config_rom and fw_unit.directory, as the memory behind them is meant to be write-once. Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
2009-12-29firewire: core: fw_csr_string addendumStefan Richter1-10/+16
Witespace and comment changes, and a different way to say i + 1 < end. Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
2009-12-29firewire: add fw_csr_string() helper functionClemens Ladisch1-33/+77
The core (sysfs attributes), the firedtv driver, and possible future drivers all read strings from some configuration ROM directory. Factor out the generic code from show_text_leaf() into a new helper function, modified slightly to handle arbitrary buffer sizes. Signed-off-by: Clemens Ladisch <clemens@ladisch.de> Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
2009-09-15driver model: constify attribute groupsDavid Brownell1-1/+1
Let attribute group vectors be declared "const". We'd like to let most attribute metadata live in read-only sections... this is a start. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2009-06-14firewire: core: don't update Broadcast_Channel if RFC 2734 conditions aren't metStefan Richter1-1/+17
This extra check will avoid Broadcast_Channel register related traffic to many IIDC, SBP-2, and AV/C devices which aren't IRMC or have a max_rec < 8 (i.e. support < 512 bytes async payload). This avoids a little bit of traffic after bus reset and is even more careful with devices which don't implement this CSR. The assumption is that no other protocol than IP over 1394 uses the broadcast channel for streams. Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
2009-06-06firewire: core: prepare for non-core children of card devicesStefan Richter1-4/+20
The IP-over-1394 driver will add child devices beneath card devices which are not of type fw_device. Hence firewire-core's callbacks in device_for_each_child() and device_find_child() need to check for the device type now. Initial version written by Jay Fenlason. Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
2009-06-06firewire: add parent-of-unit accessorStefan Richter1-2/+2
Retrieval of an fw_unit's parent is a common pattern in high-level code. Wrap it up as device = fw_parent_device(unit). Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
2009-06-05firewire: rename source filesStefan Richter1-0/+1196
The source files of firewire-core, firewire-ohci, firewire-sbp2, i.e. "drivers/firewire/fw-*.c" are renamed to "drivers/firewire/core-*.c", "drivers/firewire/ohci.c", "drivers/firewire/sbp2.c". The old fw- prefix was redundant to the directory name. The new core- prefix distinguishes the files according to which driver they belong to. This change comes a little late, but still before further firewire drivers are added as anticipated RSN. Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>