1. 25 1月, 2018 4 次提交
  2. 16 6月, 2017 3 次提交
    • J
      networking: add and use skb_put_u8() · 634fef61
      Johannes Berg 提交于
      Joe and Bjørn suggested that it'd be nicer to not have the
      cast in the fairly common case of doing
      	*(u8 *)skb_put(skb, 1) = c;
      
      Add skb_put_u8() for this case, and use it across the code,
      using the following spatch:
      
          @@
          expression SKB, C, S;
          typedef u8;
          identifier fn = {skb_put};
          fresh identifier fn2 = fn ## "_u8";
          @@
          - *(u8 *)fn(SKB, S) = C;
          + fn2(SKB, C);
      
      Note that due to the "S", the spatch isn't perfect, it should
      have checked that S is 1, but there's also places that use a
      sizeof expression like sizeof(var) or sizeof(u8) etc. Turns
      out that nobody ever did something like
      	*(u8 *)skb_put(skb, 2) = c;
      
      which would be wrong anyway since the second byte wouldn't be
      initialized.
      Suggested-by: NJoe Perches <joe@perches.com>
      Suggested-by: NBjørn Mork <bjorn@mork.no>
      Signed-off-by: NJohannes Berg <johannes.berg@intel.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      634fef61
    • J
      networking: make skb_put & friends return void pointers · 4df864c1
      Johannes Berg 提交于
      It seems like a historic accident that these return unsigned char *,
      and in many places that means casts are required, more often than not.
      
      Make these functions (skb_put, __skb_put and pskb_put) return void *
      and remove all the casts across the tree, adding a (u8 *) cast only
      where the unsigned char pointer was used directly, all done with the
      following spatch:
      
          @@
          expression SKB, LEN;
          typedef u8;
          identifier fn = { skb_put, __skb_put };
          @@
          - *(fn(SKB, LEN))
          + *(u8 *)fn(SKB, LEN)
      
          @@
          expression E, SKB, LEN;
          identifier fn = { skb_put, __skb_put };
          type T;
          @@
          - E = ((T *)(fn(SKB, LEN)))
          + E = fn(SKB, LEN)
      
      which actually doesn't cover pskb_put since there are only three
      users overall.
      
      A handful of stragglers were converted manually, notably a macro in
      drivers/isdn/i4l/isdn_bsdcomp.c and, oddly enough, one of the many
      instances in net/bluetooth/hci_sock.c. In the former file, I also
      had to fix one whitespace problem spatch introduced.
      Signed-off-by: NJohannes Berg <johannes.berg@intel.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      4df864c1
    • J
      networking: introduce and use skb_put_data() · 59ae1d12
      Johannes Berg 提交于
      A common pattern with skb_put() is to just want to memcpy()
      some data into the new space, introduce skb_put_data() for
      this.
      
      An spatch similar to the one for skb_put_zero() converts many
      of the places using it:
      
          @@
          identifier p, p2;
          expression len, skb, data;
          type t, t2;
          @@
          (
          -p = skb_put(skb, len);
          +p = skb_put_data(skb, data, len);
          |
          -p = (t)skb_put(skb, len);
          +p = skb_put_data(skb, data, len);
          )
          (
          p2 = (t2)p;
          -memcpy(p2, data, len);
          |
          -memcpy(p, data, len);
          )
      
          @@
          type t, t2;
          identifier p, p2;
          expression skb, data;
          @@
          t *p;
          ...
          (
          -p = skb_put(skb, sizeof(t));
          +p = skb_put_data(skb, data, sizeof(t));
          |
          -p = (t *)skb_put(skb, sizeof(t));
          +p = skb_put_data(skb, data, sizeof(t));
          )
          (
          p2 = (t2)p;
          -memcpy(p2, data, sizeof(*p));
          |
          -memcpy(p, data, sizeof(*p));
          )
      
          @@
          expression skb, len, data;
          @@
          -memcpy(skb_put(skb, len), data, len);
          +skb_put_data(skb, data, len);
      
      (again, manually post-processed to retain some comments)
      Reviewed-by: NStephen Hemminger <stephen@networkplumber.org>
      Signed-off-by: NJohannes Berg <johannes.berg@intel.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      59ae1d12
  3. 10 6月, 2017 1 次提交
  4. 13 4月, 2017 4 次提交
  5. 20 9月, 2016 1 次提交
  6. 12 7月, 2016 1 次提交
  7. 03 5月, 2016 1 次提交
  8. 24 2月, 2016 1 次提交
  9. 10 12月, 2015 2 次提交
  10. 20 11月, 2015 1 次提交
  11. 21 10月, 2015 2 次提交
  12. 01 10月, 2015 1 次提交
    • J
      Bluetooth: hci_intel: Cleanup the device probe code · 23270e16
      Jarkko Nikula 提交于
      There is some unneeded code in "hci_intel" probing. First
      acpi_match_device() call is needless as driver/platform/acpi core code has
      already done the matching before calling the probe and the driver does not
      use the returned pointer to matching _HID other than checking is it NULL.
      
      Then tree wide grep for "hci_intel" doesn't reveal that there is any code
      registering this platform device so it looks this device is always backed
      with ACPI companion so also ACPI_HANDLE() test can be removed.
      Signed-off-by: NJarkko Nikula <jarkko.nikula@linux.intel.com>
      Signed-off-by: NMarcel Holtmann <marcel@holtmann.org>
      23270e16
  13. 17 9月, 2015 12 次提交
  14. 29 8月, 2015 2 次提交
    • L
      Bluetooth: hci_intel: Add support for platform driver · 1ab1f239
      Loic Poulain 提交于
      A platform device can be used to provide some specific resources in
      order to manage the controller. In this first patch we retrieve the
      reset gpio which is used to power on/off the controller.
      
      The main issue is to match the current tty with the correct pdev.
      In case of ACPI, we can easily find the right tty/pdev pair because
      they are both child of the same UART port.
      
      If controller is powered-on from the driver, we need to wait for a
      HCI boot event before being able to send any command.
      Signed-off-by: NLoic Poulain <loic.poulain@intel.com>
      Signed-off-by: NMarcel Holtmann <marcel@holtmann.org>
      1ab1f239
    • L
      Bluetooth: hci_intel: Add Intel baudrate configuration support · ff289559
      Loic Poulain 提交于
      Implement the set_baudrate callback for hci_intel.
       - Controller requires a read Intel version command before updating
         its baudrate.
       - The operation consists in an async cmd since the controller does
         not respond at the same speed.
       - Wait 100ms to let the controller change its baudrate.
       - Clear RTS until we change our own UART speed
      
      Manage speed change in the setup function, we need to restore the oper
      speed once chip has booted on patched firmware.
      Signed-off-by: NLoic Poulain <loic.poulain@intel.com>
      Signed-off-by: NMarcel Holtmann <marcel@holtmann.org>
      ff289559
  15. 23 7月, 2015 4 次提交