tree:   https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core.git 
platform_groups
head:   50aeeab171b81b604c2d3c23fc92f9fd87e40c8c
commit: 50aeeab171b81b604c2d3c23fc92f9fd87e40c8c [31/31] input: axp20x-pek: 
convert platform driver to use dev_groups
config: xtensa-allyesconfig (attached as .config)
compiler: xtensa-linux-gcc (GCC) 7.4.0
reproduce:
        wget 
https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O 
~/bin/make.cross
        chmod +x ~/bin/make.cross
        git checkout 50aeeab171b81b604c2d3c23fc92f9fd87e40c8c
        # save the attached .config to linux build tree
        GCC_VERSION=7.4.0 make.cross ARCH=xtensa 

If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <l...@intel.com>

All errors (new ones prefixed by >>):

   In file included from include/linux/kobject.h:20:0,
                    from include/linux/device.h:16,
                    from include/linux/acpi.h:14,
                    from drivers/input/misc/axp20x-pek.c:16:
>> drivers/input/misc/axp20x-pek.c:203:18: error: 'axp20x_attrs' undeclared 
>> here (not in a function); did you mean 'axp20x_time'?
    ATTRIBUTE_GROUPS(axp20x);
                     ^
   include/linux/sysfs.h:154:11: note: in definition of macro 'ATTRIBUTE_GROUPS'
     .attrs = _name##_attrs,     \
              ^~~~~
   drivers/input/misc/axp20x-pek.c:198:26: warning: 'axp20x_attributes' defined 
but not used [-Wunused-variable]
    static struct attribute *axp20x_attributes[] = {
                             ^~~~~~~~~~~~~~~~~

vim +203 drivers/input/misc/axp20x-pek.c

  > 16  #include <linux/acpi.h>
    17  #include <linux/errno.h>
    18  #include <linux/irq.h>
    19  #include <linux/init.h>
    20  #include <linux/input.h>
    21  #include <linux/interrupt.h>
    22  #include <linux/kernel.h>
    23  #include <linux/mfd/axp20x.h>
    24  #include <linux/module.h>
    25  #include <linux/platform_device.h>
    26  #include <linux/regmap.h>
    27  #include <linux/slab.h>
    28  
    29  #define AXP20X_PEK_STARTUP_MASK         (0xc0)
    30  #define AXP20X_PEK_SHUTDOWN_MASK        (0x03)
    31  
    32  struct axp20x_info {
    33          const struct axp20x_time *startup_time;
    34          unsigned int startup_mask;
    35          const struct axp20x_time *shutdown_time;
    36          unsigned int shutdown_mask;
    37  };
    38  
    39  struct axp20x_pek {
    40          struct axp20x_dev *axp20x;
    41          struct input_dev *input;
    42          struct axp20x_info *info;
    43          int irq_dbr;
    44          int irq_dbf;
    45  };
    46  
    47  struct axp20x_time {
    48          unsigned int time;
    49          unsigned int idx;
    50  };
    51  
    52  static const struct axp20x_time startup_time[] = {
    53          { .time = 128,  .idx = 0 },
    54          { .time = 1000, .idx = 2 },
    55          { .time = 3000, .idx = 1 },
    56          { .time = 2000, .idx = 3 },
    57  };
    58  
    59  static const struct axp20x_time axp221_startup_time[] = {
    60          { .time = 128,  .idx = 0 },
    61          { .time = 1000, .idx = 1 },
    62          { .time = 2000, .idx = 2 },
    63          { .time = 3000, .idx = 3 },
    64  };
    65  
    66  static const struct axp20x_time shutdown_time[] = {
    67          { .time = 4000,  .idx = 0 },
    68          { .time = 6000,  .idx = 1 },
    69          { .time = 8000,  .idx = 2 },
    70          { .time = 10000, .idx = 3 },
    71  };
    72  
    73  static const struct axp20x_info axp20x_info = {
    74          .startup_time = startup_time,
    75          .startup_mask = AXP20X_PEK_STARTUP_MASK,
    76          .shutdown_time = shutdown_time,
    77          .shutdown_mask = AXP20X_PEK_SHUTDOWN_MASK,
    78  };
    79  
    80  static const struct axp20x_info axp221_info = {
    81          .startup_time = axp221_startup_time,
    82          .startup_mask = AXP20X_PEK_STARTUP_MASK,
    83          .shutdown_time = shutdown_time,
    84          .shutdown_mask = AXP20X_PEK_SHUTDOWN_MASK,
    85  };
    86  
    87  static ssize_t axp20x_show_attr(struct device *dev,
    88                                  const struct axp20x_time *time,
    89                                  unsigned int mask, char *buf)
    90  {
    91          struct axp20x_pek *axp20x_pek = dev_get_drvdata(dev);
    92          unsigned int val;
    93          int ret, i;
    94  
    95          ret = regmap_read(axp20x_pek->axp20x->regmap, AXP20X_PEK_KEY, 
&val);
    96          if (ret != 0)
    97                  return ret;
    98  
    99          val &= mask;
   100          val >>= ffs(mask) - 1;
   101  
   102          for (i = 0; i < 4; i++)
   103                  if (val == time[i].idx)
   104                          val = time[i].time;
   105  
   106          return sprintf(buf, "%u\n", val);
   107  }
   108  
   109  static ssize_t axp20x_show_attr_startup(struct device *dev,
   110                                          struct device_attribute *attr,
   111                                          char *buf)
   112  {
   113          struct axp20x_pek *axp20x_pek = dev_get_drvdata(dev);
   114  
   115          return axp20x_show_attr(dev, axp20x_pek->info->startup_time,
   116                                  axp20x_pek->info->startup_mask, buf);
   117  }
   118  
   119  static ssize_t axp20x_show_attr_shutdown(struct device *dev,
   120                                           struct device_attribute *attr,
   121                                           char *buf)
   122  {
   123          struct axp20x_pek *axp20x_pek = dev_get_drvdata(dev);
   124  
   125          return axp20x_show_attr(dev, axp20x_pek->info->shutdown_time,
   126                                  axp20x_pek->info->shutdown_mask, buf);
   127  }
   128  
   129  static ssize_t axp20x_store_attr(struct device *dev,
   130                                   const struct axp20x_time *time,
   131                                   unsigned int mask, const char *buf,
   132                                   size_t count)
   133  {
   134          struct axp20x_pek *axp20x_pek = dev_get_drvdata(dev);
   135          char val_str[20];
   136          size_t len;
   137          int ret, i;
   138          unsigned int val, idx = 0;
   139          unsigned int best_err = UINT_MAX;
   140  
   141          val_str[sizeof(val_str) - 1] = '\0';
   142          strncpy(val_str, buf, sizeof(val_str) - 1);
   143          len = strlen(val_str);
   144  
   145          if (len && val_str[len - 1] == '\n')
   146                  val_str[len - 1] = '\0';
   147  
   148          ret = kstrtouint(val_str, 10, &val);
   149          if (ret)
   150                  return ret;
   151  
   152          for (i = 3; i >= 0; i--) {
   153                  unsigned int err;
   154  
   155                  err = abs(time[i].time - val);
   156                  if (err < best_err) {
   157                          best_err = err;
   158                          idx = time[i].idx;
   159                  }
   160  
   161                  if (!err)
   162                          break;
   163          }
   164  
   165          idx <<= ffs(mask) - 1;
   166          ret = regmap_update_bits(axp20x_pek->axp20x->regmap, 
AXP20X_PEK_KEY,
   167                                   mask, idx);
   168          if (ret != 0)
   169                  return -EINVAL;
   170  
   171          return count;
   172  }
   173  
   174  static ssize_t axp20x_store_attr_startup(struct device *dev,
   175                                           struct device_attribute *attr,
   176                                           const char *buf, size_t count)
   177  {
   178          struct axp20x_pek *axp20x_pek = dev_get_drvdata(dev);
   179  
   180          return axp20x_store_attr(dev, axp20x_pek->info->startup_time,
   181                                   axp20x_pek->info->startup_mask, buf, 
count);
   182  }
   183  
   184  static ssize_t axp20x_store_attr_shutdown(struct device *dev,
   185                                            struct device_attribute *attr,
   186                                            const char *buf, size_t count)
   187  {
   188          struct axp20x_pek *axp20x_pek = dev_get_drvdata(dev);
   189  
   190          return axp20x_store_attr(dev, axp20x_pek->info->shutdown_time,
   191                                   axp20x_pek->info->shutdown_mask, buf, 
count);
   192  }
   193  
   194  DEVICE_ATTR(startup, 0644, axp20x_show_attr_startup, 
axp20x_store_attr_startup);
   195  DEVICE_ATTR(shutdown, 0644, axp20x_show_attr_shutdown,
   196              axp20x_store_attr_shutdown);
   197  
   198  static struct attribute *axp20x_attributes[] = {
   199          &dev_attr_startup.attr,
   200          &dev_attr_shutdown.attr,
   201          NULL,
   202  };
 > 203  ATTRIBUTE_GROUPS(axp20x);
   204  

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

Attachment: .config.gz
Description: application/gzip

_______________________________________________
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

Reply via email to