Merge tag 'hte/for-5.19' of git://git.kernel.org/pub/scm/linux/kernel/git/tegra/linux
authorLinus Torvalds <torvalds@linux-foundation.org>
Mon, 18 Jul 2022 18:47:04 +0000 (11:47 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Mon, 18 Jul 2022 18:47:04 +0000 (11:47 -0700)
Pull hardware timestamp fix from Thierry Reding:
 "A single fix for an out-of-sync kerneldoc comment"

* tag 'hte/for-5.19' of git://git.kernel.org/pub/scm/linux/kernel/git/tegra/linux:
  gpiolib: cdev: Fix kernel doc for struct line

1  2 
drivers/gpio/gpiolib-cdev.c

index 0c9a63becfef5c38fb2254643ee7bd0b0905905a,7a952a0307cd4abd2563af487a2aeb10a5e0000a..b26e643383762b189d3a7733be5ac4f319bec4c6
@@@ -198,15 -198,16 +198,15 @@@ static long linehandle_ioctl(struct fil
        void __user *ip = (void __user *)arg;
        struct gpiohandle_data ghd;
        DECLARE_BITMAP(vals, GPIOHANDLES_MAX);
 -      int i;
 +      unsigned int i;
 +      int ret;
  
 -      if (cmd == GPIOHANDLE_GET_LINE_VALUES_IOCTL) {
 -              /* NOTE: It's ok to read values of output lines. */
 -              int ret = gpiod_get_array_value_complex(false,
 -                                                      true,
 -                                                      lh->num_descs,
 -                                                      lh->descs,
 -                                                      NULL,
 -                                                      vals);
 +      switch (cmd) {
 +      case GPIOHANDLE_GET_LINE_VALUES_IOCTL:
 +              /* NOTE: It's okay to read values of output lines */
 +              ret = gpiod_get_array_value_complex(false, true,
 +                                                  lh->num_descs, lh->descs,
 +                                                  NULL, vals);
                if (ret)
                        return ret;
  
                        return -EFAULT;
  
                return 0;
 -      } else if (cmd == GPIOHANDLE_SET_LINE_VALUES_IOCTL) {
 +      case GPIOHANDLE_SET_LINE_VALUES_IOCTL:
                /*
                 * All line descriptors were created at once with the same
                 * flags so just check if the first one is really output.
                                                     lh->descs,
                                                     NULL,
                                                     vals);
 -      } else if (cmd == GPIOHANDLE_SET_CONFIG_IOCTL) {
 +      case GPIOHANDLE_SET_CONFIG_IOCTL:
                return linehandle_set_config(lh, ip);
 +      default:
 +              return -EINVAL;
        }
 -      return -EINVAL;
  }
  
  #ifdef CONFIG_COMPAT
@@@ -421,6 -421,10 +421,10 @@@ out_free_lh
   * @work: the worker that implements software debouncing
   * @sw_debounced: flag indicating if the software debouncer is active
   * @level: the current debounced physical level of the line
+  * @hdesc: the Hardware Timestamp Engine (HTE) descriptor
+  * @raw_level: the line level at the time of event
+  * @total_discard_seq: the running counter of the discarded events
+  * @last_seqno: the last sequence number before debounce period expires
   */
  struct line {
        struct gpio_desc *desc;
@@@ -1368,16 -1372,14 +1372,16 @@@ static long linereq_ioctl(struct file *
        struct linereq *lr = file->private_data;
        void __user *ip = (void __user *)arg;
  
 -      if (cmd == GPIO_V2_LINE_GET_VALUES_IOCTL)
 +      switch (cmd) {
 +      case GPIO_V2_LINE_GET_VALUES_IOCTL:
                return linereq_get_values(lr, ip);
 -      else if (cmd == GPIO_V2_LINE_SET_VALUES_IOCTL)
 +      case GPIO_V2_LINE_SET_VALUES_IOCTL:
                return linereq_set_values(lr, ip);
 -      else if (cmd == GPIO_V2_LINE_SET_CONFIG_IOCTL)
 +      case GPIO_V2_LINE_SET_CONFIG_IOCTL:
                return linereq_set_config(lr, ip);
 -
 -      return -EINVAL;
 +      default:
 +              return -EINVAL;
 +      }
  }
  
  #ifdef CONFIG_COMPAT
@@@ -1460,12 -1462,11 +1464,12 @@@ static ssize_t linereq_read(struct fil
  static void linereq_free(struct linereq *lr)
  {
        unsigned int i;
 -      bool hte;
 +      bool hte = false;
  
        for (i = 0; i < lr->num_lines; i++) {
 -              hte = !!test_bit(FLAG_EVENT_CLOCK_HTE,
 -                               &lr->lines[i].desc->flags);
 +              if (lr->lines[i].desc)
 +                      hte = !!test_bit(FLAG_EVENT_CLOCK_HTE,
 +                                       &lr->lines[i].desc->flags);
                edge_detector_stop(&lr->lines[i], hte);
                if (lr->lines[i].desc)
                        gpiod_free(lr->lines[i].desc);
@@@ -2302,30 -2303,28 +2306,30 @@@ static long gpio_ioctl(struct file *fil
                return -ENODEV;
  
        /* Fill in the struct and pass to userspace */
 -      if (cmd == GPIO_GET_CHIPINFO_IOCTL) {
 +      switch (cmd) {
 +      case GPIO_GET_CHIPINFO_IOCTL:
                return chipinfo_get(cdev, ip);
  #ifdef CONFIG_GPIO_CDEV_V1
 -      } else if (cmd == GPIO_GET_LINEHANDLE_IOCTL) {
 +      case GPIO_GET_LINEHANDLE_IOCTL:
                return linehandle_create(gdev, ip);
 -      } else if (cmd == GPIO_GET_LINEEVENT_IOCTL) {
 +      case GPIO_GET_LINEEVENT_IOCTL:
                return lineevent_create(gdev, ip);
 -      } else if (cmd == GPIO_GET_LINEINFO_IOCTL ||
 -                 cmd == GPIO_GET_LINEINFO_WATCH_IOCTL) {
 -              return lineinfo_get_v1(cdev, ip,
 -                                     cmd == GPIO_GET_LINEINFO_WATCH_IOCTL);
 +      case GPIO_GET_LINEINFO_IOCTL:
 +              return lineinfo_get_v1(cdev, ip, false);
 +      case GPIO_GET_LINEINFO_WATCH_IOCTL:
 +              return lineinfo_get_v1(cdev, ip, true);
  #endif /* CONFIG_GPIO_CDEV_V1 */
 -      } else if (cmd == GPIO_V2_GET_LINEINFO_IOCTL ||
 -                 cmd == GPIO_V2_GET_LINEINFO_WATCH_IOCTL) {
 -              return lineinfo_get(cdev, ip,
 -                                  cmd == GPIO_V2_GET_LINEINFO_WATCH_IOCTL);
 -      } else if (cmd == GPIO_V2_GET_LINE_IOCTL) {
 +      case GPIO_V2_GET_LINEINFO_IOCTL:
 +              return lineinfo_get(cdev, ip, false);
 +      case GPIO_V2_GET_LINEINFO_WATCH_IOCTL:
 +              return lineinfo_get(cdev, ip, true);
 +      case GPIO_V2_GET_LINE_IOCTL:
                return linereq_create(gdev, ip);
 -      } else if (cmd == GPIO_GET_LINEINFO_UNWATCH_IOCTL) {
 +      case GPIO_GET_LINEINFO_UNWATCH_IOCTL:
                return lineinfo_unwatch(cdev, ip);
 +      default:
 +              return -EINVAL;
        }
 -      return -EINVAL;
  }
  
  #ifdef CONFIG_COMPAT