1. 05 6月, 2009 2 次提交
  2. 01 6月, 2009 2 次提交
    • S
      firewire: core: add sysfs attribute for easier udev rules · 0210b66d
      Stefan Richter 提交于
      This adds the attribute /sys/bus/firewire/devices/fw[0-9]+/units.  It
      can be used in udev rules like the following ones:
      
      # IIDC devices: industrial cameras and some webcams
      SUBSYSTEM=="firewire", ATTR{units}=="*0x00a02d:0x00010?*", GROUP="video"
      
      # AV/C devices: camcorders, set-top boxes, TV sets, audio devices, ...
      SUBSYSTEM=="firewire", ATTR{units}=="*0x00a02d:0x010001*", GROUP="video"
      
      Background:
      
      firewire-core manages two device types:
        - fw_device is a FireWire node.  A character device file is associated
          with it.
        - fw_unit is a unit directory on a node.  Each fw_device may have 0..n
          children of type fw_unit.  The units tell us what kinds of protocols
          a node implements.
      
      We want to set ownership or ACLs or permissions of the character device
      file of an fw_device, or/and create symlinks to it, based on available
      protocols.  Until now udev rules had to look at the fw_unit devices and
      then modify their parent's character device file accordingly.  This is
      problematic for two reasons:  1) It happens sometime after the creation
      of the fw_device, 2) an access policy may require that information from
      all children is evaluated before a decision about the parent is made.
      
      Problem 1) can ultimately not be avoided since this is the nature of
      FireWire nodes:  They may add or remove unit directories at any point in
      time.
      
      However, we can still help userland a lot by providing the protocol type
      information of all units in a summary sysfs attribute directly at the
      fw_device.  This way,
         - the information is immediately available at the affected device
           when userspace goes about to handle an ADD or CHANGE event of the
           fw_device,
         - with most policies, it won't be necessary anymore to dig through
           child attributes.
      
      The new attribute is called "units".  It contains space-separated tuples
      of specifier_id and version of each present unit.  The delimiter within
      tuples is a colon.  Specifier_id and version are printed as 0x%06x.
      
      Here is an example of a node which implements an IPv4 unit and an IPv6
      unit:  $ cat /sys/bus/firewire/devices/fw2/units
      0x00005e:0x000001 0x00005e:0x000002
      Signed-off-by: NStefan Richter <stefanr@s5r6.in-berlin.de>
      0210b66d
    • S
      firewire: core: check for missing struct update at build time, not run time · e5333db9
      Stefan Richter 提交于
      struct fw_attribute_group.attrs.[] must have enough room for all
      attributes.  This can and should be checked at build time.
      
      Our previous check at run time was a little late and not reliable since
      most of the time less than the available attributes are populated.
      
      Furthermore, omit an increment of an index at its last usage.
      Signed-off-by: NStefan Richter <stefanr@s5r6.in-berlin.de>
      e5333db9
  3. 17 5月, 2009 1 次提交
    • S
      firewire: core: improve check for local node · 92368890
      Stefan Richter 提交于
      My recently added test for a device being local in fw-cdev.c got it
      slightly wrong:  Comparisons of node IDs are only valid if the
      generation is current, which I forgot to check.  Normally, serialization
      by card->lock takes care of this, but a device in FW_DEVICE_GONE state
      will necessarily have a wrong generation and invalid node_id.
      
      The "is it local?" check is made 100% correct and simpler now by means
      of a struct fw_device flag which is set at fw_device creation.
      
      Besides the fw-cdev site which was to be fixed, there is another site
      which can make use of the new flag, and an RFC-2734 driver will benefit
      from it too.
      Signed-off-by: NStefan Richter <stefanr@s5r6.in-berlin.de>
      92368890
  4. 25 3月, 2009 9 次提交
  5. 25 1月, 2009 1 次提交
    • S
      firewire: core: optimize card shutdown · e747a5c0
      Stefan Richter 提交于
      This fixes a regression by "firewire: keep highlevel drivers attached
      during brief connection loss":  There were 2 seconds unnecessary waiting
      added to the shutdown procedure of each controller.
      
      We use card->link as status flag to signal the device handler that there
      is no use to wait for a come-back.
      Signed-off-by: NStefan Richter <stefanr@s5r6.in-berlin.de>
      e747a5c0
  6. 21 1月, 2009 1 次提交
    • S
      firewire: keep highlevel drivers attached during brief connection loss · 3d36a0df
      Stefan Richter 提交于
      There are situations when nodes vanish from the bus and come back
      quickly thereafter:
        - When certain bus-powered hubs are plugged in,
        - when certain devices are plugged into 6-port hubs,
        - when certain disk enclosures are switched from self-power to bus
          power or vice versa and break the daisy chain during the transition,
        - when the user plugs a cable out and quickly plugs it back in, e.g.
          to reorder a daisy chain (works on Mac OS X if done quickly enough),
        - when certain hubs temporarily malfunction during high bus traffic.
      
      Until now, firewire-core reported affected nodes as lost to the
      highlevel drivers (firewire-sbp2 and userspace drivers).  We now delay
      the destruction of device representations until after at least two
      seconds after the last bus reset.  If a "new" device is detected in this
      period whose bus information block and root directory header match that
      of a device which is pending for deletion, we resurrect that device and
      send update calls to highlevel drivers.
      Signed-off-by: NStefan Richter <stefanr@s5r6.in-berlin.de>
      3d36a0df
  7. 10 1月, 2009 1 次提交
  8. 05 1月, 2009 2 次提交
  9. 31 10月, 2008 1 次提交
  10. 16 10月, 2008 1 次提交
  11. 14 7月, 2008 1 次提交
    • S
      firewire: clean up fw_card reference counting · 459f7923
      Stefan Richter 提交于
      This is a functionally equivalent replacement of the current reference
      counting of struct fw_card instances.  It only converts it to common
      idioms as suggested by Kristian Høgsberg:
        - struct kref replaces atomic_t as the counter.
        - wait_for_completion is used to wait for all card users to complete.
      
      BTW, it may make sense to count card->flush_timer and card->work as
      card users too.
      Signed-off-by: NStefan Richter <stefanr@s5r6.in-berlin.de>
      459f7923
  12. 19 4月, 2008 1 次提交
  13. 18 4月, 2008 3 次提交
  14. 02 3月, 2008 1 次提交
    • S
      firewire: fix crash in automatic module unloading · 855c603d
      Stefan Richter 提交于
      "modprobe firewire-ohci; sleep .1; modprobe -r firewire-ohci" used to
      result in crashes like this:
      
          BUG: unable to handle kernel paging request at ffffffff8807b455
          IP: [<ffffffff8807b455>]
          PGD 203067 PUD 207063 PMD 7c170067 PTE 0
          Oops: 0010 [1] PREEMPT SMP
          CPU 0
          Modules linked in: i915 drm cpufreq_ondemand acpi_cpufreq freq_table applesmc input_polldev led_class coretemp hwmon eeprom snd_seq_oss snd_seq_midi_event snd_seq snd_seq_device snd_pcm_oss snd_mixer_oss button thermal processor sg snd_hda_intel snd_pcm snd_timer snd snd_page_alloc sky2 i2c_i801 rtc [last unloaded: crc_itu_t]
          Pid: 9, comm: events/0 Not tainted 2.6.25-rc2 #3
          RIP: 0010:[<ffffffff8807b455>]  [<ffffffff8807b455>]
          RSP: 0018:ffff81007dcdde88  EFLAGS: 00010246
          RAX: ffff81007dc95040 RBX: ffff81007dee5390 RCX: 0000000000005e13
          RDX: 0000000000008c8b RSI: 0000000000000001 RDI: ffff81007dee5388
          RBP: ffff81007dc5eb40 R08: 0000000000000002 R09: ffffffff8022d05c
          R10: ffffffff8023b34c R11: ffffffff8041a353 R12: ffff81007dee5388
          R13: ffffffff8807b455 R14: ffffffff80593bc0 R15: 0000000000000000
          FS:  0000000000000000(0000) GS:ffffffff8055a000(0000) knlGS:0000000000000000
          CS:  0010 DS: 0018 ES: 0018 CR0: 000000008005003b
          CR2: ffffffff8807b455 CR3: 0000000000201000 CR4: 00000000000006e0
          DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
          DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
          Process events/0 (pid: 9, threadinfo ffff81007dcdc000, task ffff81007dc95040)
          Stack:  ffffffff8023b396 ffffffff88082524 0000000000000000 ffffffff8807d9ae
          ffff81007dc5eb40 ffff81007dc9dce0 ffff81007dc5eb40 ffff81007dc5eb80
          ffff81007dc9dce0 ffffffffffffffff ffffffff8023be87 0000000000000000
          Call Trace:
          [<ffffffff8023b396>] ? run_workqueue+0xdf/0x1df
          [<ffffffff8023be87>] ? worker_thread+0xd8/0xe3
          [<ffffffff8023e917>] ? autoremove_wake_function+0x0/0x2e
          [<ffffffff8023bdaf>] ? worker_thread+0x0/0xe3
          [<ffffffff8023e813>] ? kthread+0x47/0x74
          [<ffffffff804198e0>] ? trace_hardirqs_on_thunk+0x35/0x3a
          [<ffffffff8020c008>] ? child_rip+0xa/0x12
          [<ffffffff8020b6e3>] ? restore_args+0x0/0x3d
          [<ffffffff8023e68a>] ? kthreadd+0x14c/0x171
          [<ffffffff8023e68a>] ? kthreadd+0x14c/0x171
          [<ffffffff8023e7cc>] ? kthread+0x0/0x74
          [<ffffffff8020bffe>] ? child_rip+0x0/0x12
      
          Code:  Bad RIP value.
          RIP  [<ffffffff8807b455>]
          RSP <ffff81007dcdde88>
          CR2: ffffffff8807b455
          ---[ end trace c7366c6657fe5bed ]---
      
      Note that this crash happened _after_ firewire-core was unloaded.  The
      shared workqueue tried to run firewire-core's device initialization jobs
      or similar jobs.
      
      The fix makes sure that firewire-ohci and hence firewire-core is not
      unloaded before all device shutdown jobs have been completed.  This is
      determined by the count of device initializations minus device releases.
      
      Also skip useless retries in the node initialization job if the node is
      to be shut down.
      Signed-off-by: NStefan Richter <stefanr@s5r6.in-berlin.de>
      Signed-off-by: NJarod Wilson <jwilson@redhat.com>
      855c603d
  15. 16 2月, 2008 2 次提交
  16. 31 1月, 2008 2 次提交
  17. 13 10月, 2007 1 次提交
    • K
      Driver core: change add_uevent_var to use a struct · 7eff2e7a
      Kay Sievers 提交于
      This changes the uevent buffer functions to use a struct instead of a
      long list of parameters. It does no longer require the caller to do the
      proper buffer termination and size accounting, which is currently wrong
      in some places. It fixes a known bug where parts of the uevent
      environment are overwritten because of wrong index calculations.
      
      Many thanks to Mathieu Desnoyers for finding bugs and improving the
      error handling.
      Signed-off-by: NKay Sievers <kay.sievers@vrfy.org>
      Cc: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
      Cc: Cornelia Huck <cornelia.huck@de.ibm.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      
      7eff2e7a
  18. 10 7月, 2007 1 次提交
  19. 11 5月, 2007 2 次提交
  20. 27 4月, 2007 2 次提交
  21. 18 4月, 2007 1 次提交
  22. 29 3月, 2007 2 次提交