aboutsummaryrefslogtreecommitdiff
path: root/drivers/ieee1394/nodemgr.c
AgeCommit message (Collapse)Author
2006-12-07ieee1394: fix printk format warningRandy Dunlap
Fix printk format warning: drivers/ieee1394/nodemgr.c:364: warning: long long unsigned int format, u64 arg (arg 3) Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com> Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
2006-12-07ieee1394: nodemgr: revise semaphore protection of driver core dataStefan Richter
- The list "struct class.children" is supposed to be protected by class.sem, not by class.subsys.rwsem. - nodemgr_remove_uds() iterated over nodemgr_ud_class.children without proper protection. This was never observed as a bug since the code is usually only accessed by knodemgrd. All knodemgrds are currently globally serialized. But userspace can trigger this code too by writing to /sys/bus/ieee1394/destroy_node. - Clean up access to the FireWire bus type's subsys.rwsem: Access it uniformly via ieee1394_bus_type. Shrink rwsem protected regions where possible. Expand them where necessary. The latter wasn't a problem so far because knodemgr is globally serialized. This should harden the interaction of ieee1394 with sysfs and lay ground for deserialized operation of multiple knodemgrds and for implementation of subthreads for parallelized scanning and probing. Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
2006-12-07ieee1394: nodemgr: reflect which return values are errorsStefan Richter
Give better names to local variables. Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
2006-12-07ieee1394: nodemgr: small fix after sysfs errors patchStefan Richter
One hunk in "ieee1394: handle sysfs errors" was wrong. Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
2006-12-07ieee1394: handle sysfs errorsStefan Richter
Handle driver core errors with as much care as appropriate. Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
2006-12-07[PATCH] Add include/linux/freezer.h and move definitions from sched.hNigel Cunningham
Move process freezing functions from include/linux/sched.h to freezer.h, so that modifications to the freezer or the kernel configuration don't require recompiling just about everything. [akpm@osdl.org: fix ueagle driver] Signed-off-by: Nigel Cunningham <nigel@suspend2.net> Cc: "Rafael J. Wysocki" <rjw@sisk.pl> Cc: Pavel Machek <pavel@ucw.cz> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-10-08ieee1394: nodemgr: fix startup of knodemgrdStefan Richter
Revert a thinko in commit d2f119fe319528da8c76a1107459d6f478cbf28c: When knodemgrd starts, it needs to sleep until host->generation was incremented above its initial value of 0. My wrong logic caused it to start sending requests when the bus wasn't completely ready. Seen as "AT dma reset ctx=0, aborting transmission" messages in 2.6.19-rc1. Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
2006-09-17ieee1394: nodemgr: grab class.subsys.rwsem in nodemgr_resume_neStefan Richter
nodemgr_resume_ne was iterating over nodemgr_ud_class.children without protection by nodemgr_ud_class.subsys.rwsem. FIXME: Shouldn't we rather use class->sem there, not class->subsys.rwsem? Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
2006-09-17ieee1394: nodemgr: fix rwsem recursionStefan Richter
nodemgr_update_pdrv grabbed an rw semaphore (as reader) which was already taken by its caller's caller, nodemgr_probe_ne (as reader too). Reported by Miles Lane, call path pointed out by Arjan van de Ven. FIXME: Shouldn't we rather use class->sem there, not class->subsys.rwsem? Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
2006-09-17ieee1394: shrink tlabel pools, remove tpool semaphoresStefan Richter
This patch reduces the size of struct hpsb_host and also removes semaphores from ieee1394_transactions.c. On i386, struct hpsb_host shrinks from 10656 bytes to 6688 bytes. This is accomplished by - using a single wait_queue for hpsb_get_tlabel instead of many instances of semaphores, - using a single lock to serialize access to all tlabel pools (the protected code regions are small, i.e. lock contention very low), - omitting the sysfs attribute tlabels_allocations. Drawback: In the rare case that a process needs to sleep because all transaction labels for the node are temporarily exhausted, it is also woken up if a tlabel for a different node became free, checks for an available tlabel, and is put to sleep again. The check is not costly and the situation occurs extremely rarely. (Tlabels are typically only exhausted if there was no context switch to the khpsbpkt thread which recycles tlables.) Therefore the benefit of reduced tpool size outweighs this drawback. The sysfs attributes tlabels_free and tlabels_mask are not compiled anymore unless CONFIG_IEEE1394_VERBOSEDEBUG is set. The by far biggest member of struct hpsb_host, the struct csr_control csr (5272 bytes on i386), is now placed at the end of struct hpsb_host. Note, hpsb_get_tlabel calls the macro wait_event_interruptible with a condition argument which has a side effect (allocation of a tlabel and manipulation of the packet). This side effect happens only if the condition is true. The patch relies on wait_event_interruptible not evaluating the condition again after it became true. Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
2006-07-03[PATCH] ieee1394: nodemgr: convert nodemgr_serialize semaphore to mutexStefan Richter
Another trivial sem2mutex conversion. Side note: nodemgr_serialize's purpose, when introduced in linux1394's revision 529 in July 2002, was to protect several data structures which are now largely handled by or together with Linux' driver core and are now protected by the LDM's own mechanisms. It may very well be possible to remove this mutex now. But fully parallelized node scanning is on our long-term TODO list anyway; the mutex will certainly go away then. Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de> Signed-off-by: Ben Collins <bcollins@ubuntu.com>
2006-07-03[PATCH] ieee1394: nodemgr: switch to kthread api, replace reset semaphoreStefan Richter
Convert nodemgr's host thread from kernel_thread to kthread and its sleep/restart mechanism from a counting semaphore to a schedule()/ wake_up_process() scheme. Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de> Signed-off-by: Ben Collins <bcollins@ubuntu.com>
2006-07-03[PATCH] ieee1394: nodemgr: make module parameter ignore_drivers writableStefan Richter
Nodemgr's ignore_drivers variable is exposed as a module load parameter (therefore also as a sysfs attribute below /sys/module) and additionally as an attribute below /sys/bus/ieee1394. Since the latter is writable, make the former writable too. Note, the bus's attribute ignore_drivers is only relevant to newly added units, not to present or suspended or resuming units. Those have their own attribute ignore_driver. Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de> Signed-off-by: Ben Collins <bcollins@ubuntu.com>
2006-07-03[PATCH] ieee1394: nodemgr: do not spawn kernel_thread for sysfs rescanStefan Richter
nodemgr.c::fw_set_rescan() is used to re-run the driver core over nodemgr's representation of unit directories in order to initiate protocol driver probes. It is initiated via write access to one of nodemgr's sysfs attributes. The purpose is to attach drivers to units after switching a unit's ignore_driver attribute from 1 to 0. It is not really necessary to fork a kernel_thread for this job. The call to kernel_thread() can be eliminated to avoid the deprecated API and to simplify the code a bit. Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de> Signed-off-by: Ben Collins <bcollins@ubuntu.com>
2006-07-03[PATCH] ieee1394: nodemgr: remove unnecessary includesStefan Richter
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de> Signed-off-by: Ben Collins <bcollins@ubuntu.com>
2006-07-03[PATCH] ieee1394: update #include directives in midlayer header filesStefan Richter
Remove unnecessary includes, add missing includes. Use forward type declarations for some structs. Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de> Signed-off-by: Ben Collins <bcollins@ubuntu.com>
2006-07-03[PATCH] ieee1394: fix cosmetic problem in speed probeStefan Richter
If ieee1394.h::IEEE1394_SPEED_MAX is bigger than the actual speed of an 1394b host adapter and the speed to another 1394b node was probed, a bigger speed than actually used was kept in host->speed[n]. The only resulting problem so far was sbp2 displaying bogus values in the syslog, e.g. S3200 for actual S800 connections if IEEE1394_SPEED_MAX was S3200. But other high-level drivers which access this field could get into more trouble. (Eth1394 is the only other in-tree driver which does so. It seems it is not affected.) Nodemgr now clips this value according to the host adapter's link speed. A pointer expression in nodemgr_check_speed is also changed for clarity. Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de> Signed-off-by: Ben Collins <bcollins@ubuntu.com>
2006-06-30Remove obsolete #include <linux/config.h>Jörn Engel
Signed-off-by: Jörn Engel <joern@wohnheim.fh-wedel.de> Signed-off-by: Adrian Bunk <bunk@stusta.de>
2006-06-25[PATCH] ieee1394: nodemgr: do not peek into struct semaphoreStefan Richter
Also revert patch "frv: ieee1394 is borken on frv", as it no longer is. Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de> Cc: David Howells <dhowells@redhat.com> Cc: Jody McIntyre <scjody@modernduck.com> Cc: Ben Collins <bcollins@ubuntu.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-06-12ieee1394: support for slow links or slow 1394b phy portsBen Collins
Add support for the following types of hardware: + nodes that have a link speed < PHY speed + 1394b PHYs that are less than S800 capable + 1394b/1394a adapter cable between two 1394b PHYs Also, S1600 and S3200 are now supported if IEEE1394_SPEED_MAX is raised. A probing function is added to nodemgr's config ROM fetching routine which adjusts the allowable speed if an access problem was encountered. Pros and Cons of the approach: + minimum code footprint to support this less widely used hardware + nearly no overhead for unaffected hardware - ineffective before nodemgr began to read the ROM of affected nodes - ineffective if ieee1394 is loaded with disable_nodemgr=1 The speed map CSRs which are published to the bus are not touched by the patch. Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de> Cc: Hakan Ardo <hakan@debian.org> Cc: Calculex <linux@calculex.com> Cc: Robert J. Kosinski <robk@cmcherald.com> Signed-off-by: Ben Collins <bcollins@ubuntu.com>
2006-01-05Merge with http://kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.gitJody McIntyre
2006-01-04[PATCH] driver core: replace "hotplug" by "uevent"Kay Sievers
Leave the overloaded "hotplug" word to susbsystems which are handling real devices. The driver core does not "plug" anything, it just exports the state to userspace and generates events. Signed-off-by: Kay Sievers <kay.sievers@suse.de> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2005-12-12ieee1394: write broadcast_channel only to select nodes (fixes device ↵Stefan Richter
recognition) Some old 1394-1995 SBP-2 bridges would hang if they received a broadcast write request to BROADCAST_CHANNEL before the config ROM was read. Affected devices include Datafab MD2-FW2 2.5" HDD and SmartDisk VST FWCDRW-V8 portable CD writer. The write request is now directed to specific nodes instead of being broadcast to all nodes at once, and it is only performed if a previous read request at this register succeeded. Fixes an old interoperability problem which was perceived as a 2.6.14-specific regression: http://marc.theaimsgroup.com/?t=113190586800003 Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de> Signed-off-by: Jody McIntyre <scjody@modernduck.com> (cherry picked from 61c7f775ca25ccfc0e51486103a724fb1a3a08f2 commit)
2005-12-12ieee1394: resume remote ports when starting a host (fixes device recognition)Stefan Richter
After initializing an IEEE 1394 host, broadcast a resume packet. This makes remote nodes visible which suspended their ports while the host was down. Such nodes had to be unplugged and replugged in order to be recognized. Motorola DCT6200 cable reciever was affected, probably other devices too. http://marc.theaimsgroup.com/?t=113202715800001 Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de> Signed-off-by: Jody McIntyre <scjody@modernduck.com> (cherry picked from 14c0fa243b358c24040ff5f44b60c47aaf6430c3 commit)
2005-12-12ieee1394: run high-level updates before high-level probesStefan Richter
After a bus reset, let nodemgr call high-level update hooks first for nodes which do not need to be probed. The main benefit is for a bus with more than one SBP-2 device: SBP-2 reconnects will be performed before SBP-2 logins, thus have a much higher chance to succeed, and their SCSI devices will not be blocked much longer than necessary. This was demonstrated for Linux 2.4 by Dave Cinege a while ago. A better approach would be to perform time-consuming probes in parallel by a subthread. I actually plan to implement this for sbp2 but it may take a while to get that done and tested. Until then, this tweak is a huge improvement for users with multiple SBP-2 devices. Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de> Signed-off-by: Jody McIntyre <scjody@modernduck.com>
2005-12-05ieee1394: write broadcast_channel only to select nodes (fixes device ↵Stefan Richter
recognition) Some old 1394-1995 SBP-2 bridges would hang if they received a broadcast write request to BROADCAST_CHANNEL before the config ROM was read. Affected devices include Datafab MD2-FW2 2.5" HDD and SmartDisk VST FWCDRW-V8 portable CD writer. The write request is now directed to specific nodes instead of being broadcast to all nodes at once, and it is only performed if a previous read request at this register succeeded. Fixes an old interoperability problem which was perceived as a 2.6.14-specific regression: http://marc.theaimsgroup.com/?t=113190586800003 Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de> Signed-off-by: Jody McIntyre <scjody@modernduck.com>
2005-12-01ieee1394: add definitions for phy packet constantsStefan Richter
Introduce new macros related to phy packets and use them in ieee1394_core and nodemgr. Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de> Signed-off-by: Jody McIntyre <scjody@modernduck.com>
2005-12-01ieee1394: resume remote ports when starting a host (fixes device recognition)Stefan Richter
After initializing an IEEE 1394 host, broadcast a resume packet. This makes remote nodes visible which suspended their ports while the host was down. Such nodes had to be unplugged and replugged in order to be recognized. Motorola DCT6200 cable reciever was affected, probably other devices too. http://marc.theaimsgroup.com/?t=113202715800001 Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de> Signed-off-by: Jody McIntyre <scjody@modernduck.com>
2005-11-07kmalloc/kzalloc changes:Stefan Richter
dv1394, eth1394, ieee1394, ohci1394, pcilynx, raw1394, sbp2c, video1394: - use kzalloc - provide safer size arguments to kmalloc and kzalloc - omit some casts Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de> Signed-off-by: Jody McIntyre <scjody@modernduck.com>
2005-10-28[PATCH] DRIVER MODEL: Get rid of the obsolete tri-level suspend/resume callbacksRussell King
In PM v1, all devices were called at SUSPEND_DISABLE level. Then all devices were called at SUSPEND_SAVE_STATE level, and finally SUSPEND_POWER_DOWN level. However, with PM v2, to maintain compatibility for platform devices, I arranged for the PM v2 suspend/resume callbacks to call the old PM v1 suspend/resume callbacks three times with each level in order so that existing drivers continued to work. Since this is obsolete infrastructure which is no longer necessary, we can remove it. Here's an (untested) patch to do exactly that. Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2005-09-30[PATCH] ieee1394: skip unnecessary pause when scanning config ROMsJody McIntyre
Skip a superfluous pause that occured when the config ROM of a node was scanned unsuccessfully. This also occurs if a node without link wrongly enables its "link active" self ID flag. A GWCTech 6-port hub does this. Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de> Signed-off-by: Jody McIntyre <scjody@steamballoon.com> Cc: Ben Collins <bcollins@debian.org> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-09-30[PATCH] ieee1394: reorder activities after bus reset (fixes device detection)Jody McIntyre
Units were not detected if the local IRM performed a bus reset. ("The root node is not cycle master capable; selecting a new root node and resetting...", often seen with iPods and other SBP-2 devices). Rearrange the order of IRM duties and node scanning. TODO: Audit the ROM caching and parsing code for underlying issues. Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de> Signed-off-by: Jody McIntyre <scjody@steamballoon.com> Cc: Ben Collins <bcollins@debian.org> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-09-07[PATCH] provide MODALIAS= enviroment variable to autoload ieee1394 modules ↵Olaf Hering
via udev https://bugzilla.novell.com/show_bug.cgi?id=103746 Old 2.6.13 hotplug enviroment for 'plug in firewire disk' event: ==> debug.01139.ieee1394.add.8211 <== set -- ieee1394 UDEV_LOG='7' ACTION='add' DEVPATH='/class/ieee1394/00010410100036e0-0' SUBSYSTEM='ieee1394' SEQNUM='1139' PHYSDEVPATH='/devices/pci0001:10/0001:10:0d.0/0001:11:0a.0/fw-host0/00010410100036e0/00010410100036e0-0' PHYSDEVBUS='ieee1394' VENDOR_ID='000000' MODEL_ID='001010' GUID='00010410100036e0' SPECIFIER_ID='00609e' VERSION='010483' UDEVD_EVENT='1' Module spb2 is not loaded. grep sbp2 /lib/modules/2.6.13-20050901172817-default/modules.alias alias ieee1394:ven*mo*sp0000609Ever00010483* sbp2 printf 'ieee1394:ven%08Xmo%08Xsp%08Xver%08X\n' '0x000000' '0x001010' '0x00609e' '0x010483' ieee1394:ven00000000mo00001010sp0000609Ever00010483 modprobe -v ieee1394:ven00000000mo00001010sp0000609Ever00010483 insmod /lib/modules/2.6.13-20050901172817-default/kernel/drivers/ieee1394/sbp2.ko Providing a MODALIAS= enviroment variable with the content above will fix it. Signed-off-by: Olaf Hering <olh@suse.de> Cc: Ben Collins <bcollins@debian.org> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-07-10[PATCH] Sync up ieee-1394Ben Collins
Lots of this patch is trivial code cleanups (static vars were being intialized to 0, etc). There's also some fixes for ISO transmits (max buffer handling). Aswell, we have a few fixes to disable IRM capabilites correctly. We've also disabled, by default some generally unused EXPORT symbols for the sake of cleanliness in the kernel. However, instead of removing them completely, we felt it necessary to have a config option that allowed them to be enabled for the many projects outside of the main kernel tree that use our API for driver development. The primary reason for this patch is to revert a MODE6->MODE10 RBC conversion patch from the SCSI maintainers. The new conversions handled directly in the scsi layer do not seem to work for SBP2. This patch reverts to our old working code so that users can enjoy using Firewire disks and dvd drives again. We are working with the SCSI maintainers to resolve this issue outside of the main kernel tree. We'll merge the patch once the SCSI layer's handling of the MODE10 conversion is working for us. Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-06-25[PATCH] Cleanup patch for process freezingChristoph Lameter
1. Establish a simple API for process freezing defined in linux/include/sched.h: frozen(process) Check for frozen process freezing(process) Check if a process is being frozen freeze(process) Tell a process to freeze (go to refrigerator) thaw_process(process) Restart process frozen_process(process) Process is frozen now 2. Remove all references to PF_FREEZE and PF_FROZEN from all kernel sources except sched.h 3. Fix numerous locations where try_to_freeze is manually done by a driver 4. Remove the argument that is no longer necessary from two function calls. 5. Some whitespace cleanup 6. Clear potential race in refrigerator (provides an open window of PF_FREEZE cleared before setting PF_FROZEN, recalc_sigpending does not check PF_FROZEN). This patch does not address the problem of freeze_processes() violating the rule that a task may only modify its own flags by setting PF_FREEZE. This is not clean in an SMP environment. freeze(process) is therefore not SMP safe! Signed-off-by: Christoph Lameter <christoph@lameter.com> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-06-20[PATCH] Driver Core: drivers/i2c/chips/w83781d.c - ↵Yani Ioannou
drivers/s390/block/dcssblk.c: update device attribute callbacks Signed-off-by: Yani Ioannou <yani.ioannou@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2005-06-20[PATCH] Use device_for_each_child() to unregister devices in ↵gregkh@suse.de
nodemgr_remove_host_dev() Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> diff -Nru a/drivers/ieee1394/nodemgr.c b/drivers/ieee1394/nodemgr.c
2005-05-17[PATCH] ieee1394: remove NULL checks for kfreeJody McIntyre
This patch removes redundant NULL pointer checks before kfree() in all of drivers/ieee1394/ Signed-off-by: Jesper Juhl <juhl-lkml@dif.dk> Signed-off-by: Jody McIntyre <scjody@steamballoon.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-04-16Linux-2.6.12-rc2Linus Torvalds
Initial git repository build. I'm not bothering with the full history, even though we have it. We can create a separate "historical" git archive of that later if we want to, and in the meantime it's about 3.2GB when imported into git - space that would just make the early git days unnecessarily complicated, when we don't have a lot of good infrastructure for it. Let it rip!