[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <202002051010.tSvPdMMe%lkp@intel.com>
Date: Wed, 5 Feb 2020 10:43:14 +0800
From: kbuild test robot <lkp@...el.com>
To: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
Cc: kbuild-all@...ts.01.org,
Enric Balletbo i Serra <enric.balletbo@...labora.com>,
Nick Crews <ncrews@...omium.org>, linux-kernel@...r.kernel.org,
Daniel Campello <campello@...omium.org>,
Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
Subject: Re: [PATCH v1] platform/chrome: wilco_ec: Platform data shan't
include kernel.h
Hi Andy,
I love your patch! Yet something to improve:
[auto build test ERROR on linus/master]
[also build test ERROR on v5.5 next-20200204]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]
url: https://github.com/0day-ci/linux/commits/Andy-Shevchenko/platform-chrome-wilco_ec-Platform-data-shan-t-include-kernel-h/20200205-035444
base: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git d4e9056daedca3891414fe3c91de3449a5dad0f2
config: x86_64-randconfig-s2-20200205 (attached as .config)
compiler: gcc-5 (Ubuntu 5.5.0-12ubuntu1) 5.5.0 20171010
reproduce:
# save the attached .config to linux build tree
make ARCH=x86_64
If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp@...el.com>
All error/warnings (new ones prefixed by >>):
>> drivers/platform/chrome/wilco_ec/sysfs.c:67:5: warning: 'struct device_attribute' declared inside parameter list
const char *buf, size_t count)
^
>> drivers/platform/chrome/wilco_ec/sysfs.c:67:5: warning: its scope is only this definition or declaration, which is probably not what you want
drivers/platform/chrome/wilco_ec/sysfs.c: In function 'boot_on_ac_store':
drivers/platform/chrome/wilco_ec/sysfs.c:69:31: error: implicit declaration of function 'dev_get_drvdata' [-Werror=implicit-function-declaration]
struct wilco_ec_device *ec = dev_get_drvdata(dev);
^
drivers/platform/chrome/wilco_ec/sysfs.c:69:31: warning: initialization makes pointer from integer without a cast [-Wint-conversion]
drivers/platform/chrome/wilco_ec/sysfs.c: At top level:
drivers/platform/chrome/wilco_ec/sysfs.c:97:8: error: type defaults to 'int' in declaration of 'DEVICE_ATTR_WO' [-Werror=implicit-int]
static DEVICE_ATTR_WO(boot_on_ac);
^
drivers/platform/chrome/wilco_ec/sysfs.c:97:1: warning: parameter names (without types) in function declaration
static DEVICE_ATTR_WO(boot_on_ac);
^
drivers/platform/chrome/wilco_ec/sysfs.c: In function 'get_info':
drivers/platform/chrome/wilco_ec/sysfs.c:101:31: warning: initialization makes pointer from integer without a cast [-Wint-conversion]
struct wilco_ec_device *ec = dev_get_drvdata(dev);
^
drivers/platform/chrome/wilco_ec/sysfs.c: At top level:
drivers/platform/chrome/wilco_ec/sysfs.c:123:6: warning: 'struct device_attribute' declared inside parameter list
char *buf)
^
drivers/platform/chrome/wilco_ec/sysfs.c:128:8: error: type defaults to 'int' in declaration of 'DEVICE_ATTR_RO' [-Werror=implicit-int]
static DEVICE_ATTR_RO(version);
^
drivers/platform/chrome/wilco_ec/sysfs.c:128:1: warning: parameter names (without types) in function declaration
static DEVICE_ATTR_RO(version);
^
drivers/platform/chrome/wilco_ec/sysfs.c:131:15: warning: 'struct device_attribute' declared inside parameter list
struct device_attribute *attr, char *buf)
^
drivers/platform/chrome/wilco_ec/sysfs.c:136:8: error: type defaults to 'int' in declaration of 'DEVICE_ATTR_RO' [-Werror=implicit-int]
static DEVICE_ATTR_RO(build_revision);
^
drivers/platform/chrome/wilco_ec/sysfs.c:136:1: warning: parameter names (without types) in function declaration
static DEVICE_ATTR_RO(build_revision);
^
drivers/platform/chrome/wilco_ec/sysfs.c:139:18: warning: 'struct device_attribute' declared inside parameter list
struct device_attribute *attr, char *buf)
^
drivers/platform/chrome/wilco_ec/sysfs.c:144:8: error: type defaults to 'int' in declaration of 'DEVICE_ATTR_RO' [-Werror=implicit-int]
static DEVICE_ATTR_RO(build_date);
^
drivers/platform/chrome/wilco_ec/sysfs.c:144:1: warning: parameter names (without types) in function declaration
static DEVICE_ATTR_RO(build_date);
^
drivers/platform/chrome/wilco_ec/sysfs.c:147:13: warning: 'struct device_attribute' declared inside parameter list
struct device_attribute *attr, char *buf)
^
drivers/platform/chrome/wilco_ec/sysfs.c:152:8: error: type defaults to 'int' in declaration of 'DEVICE_ATTR_RO' [-Werror=implicit-int]
static DEVICE_ATTR_RO(model_number);
^
drivers/platform/chrome/wilco_ec/sysfs.c:152:1: warning: parameter names (without types) in function declaration
static DEVICE_ATTR_RO(model_number);
^
drivers/platform/chrome/wilco_ec/sysfs.c:177:16: warning: 'struct device_attribute' declared inside parameter list
struct device_attribute *attr, char *buf)
^
drivers/platform/chrome/wilco_ec/sysfs.c: In function 'usb_charge_show':
drivers/platform/chrome/wilco_ec/sysfs.c:179:31: warning: initialization makes pointer from integer without a cast [-Wint-conversion]
struct wilco_ec_device *ec = dev_get_drvdata(dev);
^
drivers/platform/chrome/wilco_ec/sysfs.c: At top level:
drivers/platform/chrome/wilco_ec/sysfs.c:197:10: warning: 'struct device_attribute' declared inside parameter list
const char *buf, size_t count)
^
drivers/platform/chrome/wilco_ec/sysfs.c: In function 'usb_charge_store':
drivers/platform/chrome/wilco_ec/sysfs.c:199:31: warning: initialization makes pointer from integer without a cast [-Wint-conversion]
struct wilco_ec_device *ec = dev_get_drvdata(dev);
^
drivers/platform/chrome/wilco_ec/sysfs.c: At top level:
drivers/platform/chrome/wilco_ec/sysfs.c:223:8: error: type defaults to 'int' in declaration of 'DEVICE_ATTR_RW' [-Werror=implicit-int]
static DEVICE_ATTR_RW(usb_charge);
^
drivers/platform/chrome/wilco_ec/sysfs.c:223:1: warning: parameter names (without types) in function declaration
static DEVICE_ATTR_RW(usb_charge);
^
drivers/platform/chrome/wilco_ec/sysfs.c:226:3: error: 'dev_attr_boot_on_ac' undeclared here (not in a function)
&dev_attr_boot_on_ac.attr,
^
>> drivers/platform/chrome/wilco_ec/sysfs.c:227:3: error: 'dev_attr_build_date' undeclared here (not in a function)
&dev_attr_build_date.attr,
^
>> drivers/platform/chrome/wilco_ec/sysfs.c:228:3: error: 'dev_attr_build_revision' undeclared here (not in a function)
&dev_attr_build_revision.attr,
^
>> drivers/platform/chrome/wilco_ec/sysfs.c:229:3: error: 'dev_attr_model_number' undeclared here (not in a function)
&dev_attr_model_number.attr,
^
>> drivers/platform/chrome/wilco_ec/sysfs.c:230:3: error: 'dev_attr_usb_charge' undeclared here (not in a function)
&dev_attr_usb_charge.attr,
^
>> drivers/platform/chrome/wilco_ec/sysfs.c:231:3: error: 'dev_attr_version' undeclared here (not in a function)
&dev_attr_version.attr,
^
drivers/platform/chrome/wilco_ec/sysfs.c: In function 'wilco_ec_add_sysfs':
drivers/platform/chrome/wilco_ec/sysfs.c:241:36: error: dereferencing pointer to incomplete type 'struct device'
return sysfs_create_group(&ec->dev->kobj, &wilco_dev_attr_group);
^
drivers/platform/chrome/wilco_ec/sysfs.c:241:36: error: request for member 'kobj' in something not a structure or union
drivers/platform/chrome/wilco_ec/sysfs.c:241:28: error: passing argument 1 of 'sysfs_create_group' from incompatible pointer type [-Werror=incompatible-pointer-types]
return sysfs_create_group(&ec->dev->kobj, &wilco_dev_attr_group);
^
In file included from drivers/platform/chrome/wilco_ec/sysfs.c:12:0:
include/linux/sysfs.h:276:18: note: expected 'struct kobject *' but argument is of type 'struct attribute * (*)[1]'
int __must_check sysfs_create_group(struct kobject *kobj,
^
drivers/platform/chrome/wilco_ec/sysfs.c: In function 'wilco_ec_remove_sysfs':
drivers/platform/chrome/wilco_ec/sysfs.c:246:29: error: request for member 'kobj' in something not a structure or union
sysfs_remove_group(&ec->dev->kobj, &wilco_dev_attr_group);
^
drivers/platform/chrome/wilco_ec/sysfs.c:246:21: error: passing argument 1 of 'sysfs_remove_group' from incompatible pointer type [-Werror=incompatible-pointer-types]
sysfs_remove_group(&ec->dev->kobj, &wilco_dev_attr_group);
^
In file included from drivers/platform/chrome/wilco_ec/sysfs.c:12:0:
include/linux/sysfs.h:284:6: note: expected 'struct kobject *' but argument is of type 'struct attribute * (*)[1]'
void sysfs_remove_group(struct kobject *kobj,
^
drivers/platform/chrome/wilco_ec/sysfs.c: At top level:
drivers/platform/chrome/wilco_ec/sysfs.c:65:16: warning: 'boot_on_ac_store' defined but not used [-Wunused-function]
static ssize_t boot_on_ac_store(struct device *dev,
^
drivers/platform/chrome/wilco_ec/sysfs.c:97:8: warning: 'DEVICE_ATTR_WO' declared 'static' but never defined [-Wunused-function]
static DEVICE_ATTR_WO(boot_on_ac);
^
drivers/platform/chrome/wilco_ec/sysfs.c:122:16: warning: 'version_show' defined but not used [-Wunused-function]
static ssize_t version_show(struct device *dev, struct device_attribute *attr,
^
drivers/platform/chrome/wilco_ec/sysfs.c:152:8: warning: 'DEVICE_ATTR_RO' declared 'static' but never defined [-Wunused-function]
static DEVICE_ATTR_RO(model_number);
^
drivers/platform/chrome/wilco_ec/sysfs.c:130:16: warning: 'build_revision_show' defined but not used [-Wunused-function]
static ssize_t build_revision_show(struct device *dev,
^
drivers/platform/chrome/wilco_ec/sysfs.c:138:16: warning: 'build_date_show' defined but not used [-Wunused-function]
static ssize_t build_date_show(struct device *dev,
^
drivers/platform/chrome/wilco_ec/sysfs.c:146:16: warning: 'model_number_show' defined but not used [-Wunused-function]
static ssize_t model_number_show(struct device *dev,
^
drivers/platform/chrome/wilco_ec/sysfs.c:176:16: warning: 'usb_charge_show' defined but not used [-Wunused-function]
static ssize_t usb_charge_show(struct device *dev,
^
drivers/platform/chrome/wilco_ec/sysfs.c:195:16: warning: 'usb_charge_store' defined but not used [-Wunused-function]
static ssize_t usb_charge_store(struct device *dev,
^
drivers/platform/chrome/wilco_ec/sysfs.c:223:8: warning: 'DEVICE_ATTR_RW' declared 'static' but never defined [-Wunused-function]
static DEVICE_ATTR_RW(usb_charge);
^
cc1: some warnings being treated as errors
vim +/dev_attr_build_date +227 drivers/platform/chrome/wilco_ec/sysfs.c
79e3f1d3db3d99 Raul E Rangel 2019-06-03 64
4c1ca625c622b7 Nick Crews 2019-04-16 65 static ssize_t boot_on_ac_store(struct device *dev,
4c1ca625c622b7 Nick Crews 2019-04-16 66 struct device_attribute *attr,
4c1ca625c622b7 Nick Crews 2019-04-16 @67 const char *buf, size_t count)
4c1ca625c622b7 Nick Crews 2019-04-16 68 {
4c1ca625c622b7 Nick Crews 2019-04-16 69 struct wilco_ec_device *ec = dev_get_drvdata(dev);
4c1ca625c622b7 Nick Crews 2019-04-16 70 struct boot_on_ac_request rq;
4c1ca625c622b7 Nick Crews 2019-04-16 71 struct wilco_ec_message msg;
4c1ca625c622b7 Nick Crews 2019-04-16 72 int ret;
4c1ca625c622b7 Nick Crews 2019-04-16 73 u8 val;
4c1ca625c622b7 Nick Crews 2019-04-16 74
4c1ca625c622b7 Nick Crews 2019-04-16 75 ret = kstrtou8(buf, 10, &val);
4c1ca625c622b7 Nick Crews 2019-04-16 76 if (ret < 0)
4c1ca625c622b7 Nick Crews 2019-04-16 77 return ret;
4c1ca625c622b7 Nick Crews 2019-04-16 78 if (val > 1)
4c1ca625c622b7 Nick Crews 2019-04-16 79 return -EINVAL;
4c1ca625c622b7 Nick Crews 2019-04-16 80
4c1ca625c622b7 Nick Crews 2019-04-16 81 memset(&rq, 0, sizeof(rq));
4c1ca625c622b7 Nick Crews 2019-04-16 82 rq.cmd = CMD_KB_CMOS;
4c1ca625c622b7 Nick Crews 2019-04-16 83 rq.sub_cmd = SUB_CMD_KB_CMOS_AUTO_ON;
4c1ca625c622b7 Nick Crews 2019-04-16 84 rq.val = val;
4c1ca625c622b7 Nick Crews 2019-04-16 85
4c1ca625c622b7 Nick Crews 2019-04-16 86 memset(&msg, 0, sizeof(msg));
4c1ca625c622b7 Nick Crews 2019-04-16 87 msg.type = WILCO_EC_MSG_LEGACY;
4c1ca625c622b7 Nick Crews 2019-04-16 88 msg.request_data = &rq;
4c1ca625c622b7 Nick Crews 2019-04-16 89 msg.request_size = sizeof(rq);
4c1ca625c622b7 Nick Crews 2019-04-16 90 ret = wilco_ec_mailbox(ec, &msg);
4c1ca625c622b7 Nick Crews 2019-04-16 91 if (ret < 0)
4c1ca625c622b7 Nick Crews 2019-04-16 92 return ret;
4c1ca625c622b7 Nick Crews 2019-04-16 93
4c1ca625c622b7 Nick Crews 2019-04-16 94 return count;
4c1ca625c622b7 Nick Crews 2019-04-16 95 }
4c1ca625c622b7 Nick Crews 2019-04-16 96
4c1ca625c622b7 Nick Crews 2019-04-16 97 static DEVICE_ATTR_WO(boot_on_ac);
4c1ca625c622b7 Nick Crews 2019-04-16 98
79e3f1d3db3d99 Raul E Rangel 2019-06-03 99 static ssize_t get_info(struct device *dev, char *buf, enum get_ec_info_op op)
79e3f1d3db3d99 Raul E Rangel 2019-06-03 100 {
79e3f1d3db3d99 Raul E Rangel 2019-06-03 101 struct wilco_ec_device *ec = dev_get_drvdata(dev);
79e3f1d3db3d99 Raul E Rangel 2019-06-03 102 struct get_ec_info_req req = { .cmd = CMD_EC_INFO, .op = op };
79e3f1d3db3d99 Raul E Rangel 2019-06-03 103 struct get_ec_info_resp resp;
79e3f1d3db3d99 Raul E Rangel 2019-06-03 104 int ret;
79e3f1d3db3d99 Raul E Rangel 2019-06-03 105
79e3f1d3db3d99 Raul E Rangel 2019-06-03 106 struct wilco_ec_message msg = {
79e3f1d3db3d99 Raul E Rangel 2019-06-03 107 .type = WILCO_EC_MSG_LEGACY,
79e3f1d3db3d99 Raul E Rangel 2019-06-03 108 .request_data = &req,
79e3f1d3db3d99 Raul E Rangel 2019-06-03 109 .request_size = sizeof(req),
79e3f1d3db3d99 Raul E Rangel 2019-06-03 110 .response_data = &resp,
79e3f1d3db3d99 Raul E Rangel 2019-06-03 111 .response_size = sizeof(resp),
79e3f1d3db3d99 Raul E Rangel 2019-06-03 112 };
79e3f1d3db3d99 Raul E Rangel 2019-06-03 113
79e3f1d3db3d99 Raul E Rangel 2019-06-03 114 ret = wilco_ec_mailbox(ec, &msg);
79e3f1d3db3d99 Raul E Rangel 2019-06-03 115 if (ret < 0)
79e3f1d3db3d99 Raul E Rangel 2019-06-03 116 return ret;
79e3f1d3db3d99 Raul E Rangel 2019-06-03 117
79e3f1d3db3d99 Raul E Rangel 2019-06-03 118 return scnprintf(buf, PAGE_SIZE, "%.*s\n", (int)sizeof(resp.value),
79e3f1d3db3d99 Raul E Rangel 2019-06-03 119 (char *)&resp.value);
79e3f1d3db3d99 Raul E Rangel 2019-06-03 120 }
79e3f1d3db3d99 Raul E Rangel 2019-06-03 121
79e3f1d3db3d99 Raul E Rangel 2019-06-03 122 static ssize_t version_show(struct device *dev, struct device_attribute *attr,
79e3f1d3db3d99 Raul E Rangel 2019-06-03 123 char *buf)
79e3f1d3db3d99 Raul E Rangel 2019-06-03 124 {
79e3f1d3db3d99 Raul E Rangel 2019-06-03 125 return get_info(dev, buf, CMD_GET_EC_LABEL);
79e3f1d3db3d99 Raul E Rangel 2019-06-03 126 }
79e3f1d3db3d99 Raul E Rangel 2019-06-03 127
79e3f1d3db3d99 Raul E Rangel 2019-06-03 128 static DEVICE_ATTR_RO(version);
79e3f1d3db3d99 Raul E Rangel 2019-06-03 129
79e3f1d3db3d99 Raul E Rangel 2019-06-03 130 static ssize_t build_revision_show(struct device *dev,
79e3f1d3db3d99 Raul E Rangel 2019-06-03 131 struct device_attribute *attr, char *buf)
79e3f1d3db3d99 Raul E Rangel 2019-06-03 132 {
79e3f1d3db3d99 Raul E Rangel 2019-06-03 133 return get_info(dev, buf, CMD_GET_EC_REV);
79e3f1d3db3d99 Raul E Rangel 2019-06-03 134 }
79e3f1d3db3d99 Raul E Rangel 2019-06-03 135
79e3f1d3db3d99 Raul E Rangel 2019-06-03 136 static DEVICE_ATTR_RO(build_revision);
79e3f1d3db3d99 Raul E Rangel 2019-06-03 137
79e3f1d3db3d99 Raul E Rangel 2019-06-03 138 static ssize_t build_date_show(struct device *dev,
79e3f1d3db3d99 Raul E Rangel 2019-06-03 139 struct device_attribute *attr, char *buf)
79e3f1d3db3d99 Raul E Rangel 2019-06-03 140 {
79e3f1d3db3d99 Raul E Rangel 2019-06-03 141 return get_info(dev, buf, CMD_GET_EC_BUILD_DATE);
79e3f1d3db3d99 Raul E Rangel 2019-06-03 142 }
79e3f1d3db3d99 Raul E Rangel 2019-06-03 143
79e3f1d3db3d99 Raul E Rangel 2019-06-03 144 static DEVICE_ATTR_RO(build_date);
79e3f1d3db3d99 Raul E Rangel 2019-06-03 145
79e3f1d3db3d99 Raul E Rangel 2019-06-03 146 static ssize_t model_number_show(struct device *dev,
79e3f1d3db3d99 Raul E Rangel 2019-06-03 147 struct device_attribute *attr, char *buf)
79e3f1d3db3d99 Raul E Rangel 2019-06-03 148 {
79e3f1d3db3d99 Raul E Rangel 2019-06-03 149 return get_info(dev, buf, CMD_GET_EC_MODEL);
79e3f1d3db3d99 Raul E Rangel 2019-06-03 150 }
79e3f1d3db3d99 Raul E Rangel 2019-06-03 151
79e3f1d3db3d99 Raul E Rangel 2019-06-03 152 static DEVICE_ATTR_RO(model_number);
79e3f1d3db3d99 Raul E Rangel 2019-06-03 153
fdf0fe2df3e321 Daniel Campello 2019-10-08 154 static int send_usb_charge(struct wilco_ec_device *ec,
fdf0fe2df3e321 Daniel Campello 2019-10-08 155 struct usb_charge_request *rq,
fdf0fe2df3e321 Daniel Campello 2019-10-08 156 struct usb_charge_response *rs)
fdf0fe2df3e321 Daniel Campello 2019-10-08 157 {
fdf0fe2df3e321 Daniel Campello 2019-10-08 158 struct wilco_ec_message msg;
fdf0fe2df3e321 Daniel Campello 2019-10-08 159 int ret;
fdf0fe2df3e321 Daniel Campello 2019-10-08 160
fdf0fe2df3e321 Daniel Campello 2019-10-08 161 memset(&msg, 0, sizeof(msg));
fdf0fe2df3e321 Daniel Campello 2019-10-08 162 msg.type = WILCO_EC_MSG_LEGACY;
fdf0fe2df3e321 Daniel Campello 2019-10-08 163 msg.request_data = rq;
fdf0fe2df3e321 Daniel Campello 2019-10-08 164 msg.request_size = sizeof(*rq);
fdf0fe2df3e321 Daniel Campello 2019-10-08 165 msg.response_data = rs;
fdf0fe2df3e321 Daniel Campello 2019-10-08 166 msg.response_size = sizeof(*rs);
fdf0fe2df3e321 Daniel Campello 2019-10-08 167 ret = wilco_ec_mailbox(ec, &msg);
fdf0fe2df3e321 Daniel Campello 2019-10-08 168 if (ret < 0)
fdf0fe2df3e321 Daniel Campello 2019-10-08 169 return ret;
fdf0fe2df3e321 Daniel Campello 2019-10-08 170 if (rs->status)
fdf0fe2df3e321 Daniel Campello 2019-10-08 171 return -EIO;
fdf0fe2df3e321 Daniel Campello 2019-10-08 172
fdf0fe2df3e321 Daniel Campello 2019-10-08 173 return 0;
fdf0fe2df3e321 Daniel Campello 2019-10-08 174 }
fdf0fe2df3e321 Daniel Campello 2019-10-08 175
fdf0fe2df3e321 Daniel Campello 2019-10-08 176 static ssize_t usb_charge_show(struct device *dev,
fdf0fe2df3e321 Daniel Campello 2019-10-08 177 struct device_attribute *attr, char *buf)
fdf0fe2df3e321 Daniel Campello 2019-10-08 178 {
fdf0fe2df3e321 Daniel Campello 2019-10-08 179 struct wilco_ec_device *ec = dev_get_drvdata(dev);
fdf0fe2df3e321 Daniel Campello 2019-10-08 180 struct usb_charge_request rq;
fdf0fe2df3e321 Daniel Campello 2019-10-08 181 struct usb_charge_response rs;
fdf0fe2df3e321 Daniel Campello 2019-10-08 182 int ret;
fdf0fe2df3e321 Daniel Campello 2019-10-08 183
fdf0fe2df3e321 Daniel Campello 2019-10-08 184 memset(&rq, 0, sizeof(rq));
fdf0fe2df3e321 Daniel Campello 2019-10-08 185 rq.cmd = CMD_USB_CHARGE;
fdf0fe2df3e321 Daniel Campello 2019-10-08 186 rq.op = USB_CHARGE_GET;
fdf0fe2df3e321 Daniel Campello 2019-10-08 187
fdf0fe2df3e321 Daniel Campello 2019-10-08 188 ret = send_usb_charge(ec, &rq, &rs);
fdf0fe2df3e321 Daniel Campello 2019-10-08 189 if (ret < 0)
fdf0fe2df3e321 Daniel Campello 2019-10-08 190 return ret;
fdf0fe2df3e321 Daniel Campello 2019-10-08 191
fdf0fe2df3e321 Daniel Campello 2019-10-08 192 return sprintf(buf, "%d\n", rs.val);
fdf0fe2df3e321 Daniel Campello 2019-10-08 193 }
fdf0fe2df3e321 Daniel Campello 2019-10-08 194
fdf0fe2df3e321 Daniel Campello 2019-10-08 195 static ssize_t usb_charge_store(struct device *dev,
fdf0fe2df3e321 Daniel Campello 2019-10-08 196 struct device_attribute *attr,
fdf0fe2df3e321 Daniel Campello 2019-10-08 197 const char *buf, size_t count)
fdf0fe2df3e321 Daniel Campello 2019-10-08 198 {
fdf0fe2df3e321 Daniel Campello 2019-10-08 199 struct wilco_ec_device *ec = dev_get_drvdata(dev);
fdf0fe2df3e321 Daniel Campello 2019-10-08 200 struct usb_charge_request rq;
fdf0fe2df3e321 Daniel Campello 2019-10-08 201 struct usb_charge_response rs;
fdf0fe2df3e321 Daniel Campello 2019-10-08 202 int ret;
fdf0fe2df3e321 Daniel Campello 2019-10-08 203 u8 val;
fdf0fe2df3e321 Daniel Campello 2019-10-08 204
fdf0fe2df3e321 Daniel Campello 2019-10-08 205 ret = kstrtou8(buf, 10, &val);
fdf0fe2df3e321 Daniel Campello 2019-10-08 206 if (ret < 0)
fdf0fe2df3e321 Daniel Campello 2019-10-08 207 return ret;
fdf0fe2df3e321 Daniel Campello 2019-10-08 208 if (val > 1)
fdf0fe2df3e321 Daniel Campello 2019-10-08 209 return -EINVAL;
fdf0fe2df3e321 Daniel Campello 2019-10-08 210
fdf0fe2df3e321 Daniel Campello 2019-10-08 211 memset(&rq, 0, sizeof(rq));
fdf0fe2df3e321 Daniel Campello 2019-10-08 212 rq.cmd = CMD_USB_CHARGE;
fdf0fe2df3e321 Daniel Campello 2019-10-08 213 rq.op = USB_CHARGE_SET;
fdf0fe2df3e321 Daniel Campello 2019-10-08 214 rq.val = val;
fdf0fe2df3e321 Daniel Campello 2019-10-08 215
fdf0fe2df3e321 Daniel Campello 2019-10-08 216 ret = send_usb_charge(ec, &rq, &rs);
fdf0fe2df3e321 Daniel Campello 2019-10-08 217 if (ret < 0)
fdf0fe2df3e321 Daniel Campello 2019-10-08 218 return ret;
fdf0fe2df3e321 Daniel Campello 2019-10-08 219
fdf0fe2df3e321 Daniel Campello 2019-10-08 220 return count;
fdf0fe2df3e321 Daniel Campello 2019-10-08 221 }
fdf0fe2df3e321 Daniel Campello 2019-10-08 222
fdf0fe2df3e321 Daniel Campello 2019-10-08 223 static DEVICE_ATTR_RW(usb_charge);
79e3f1d3db3d99 Raul E Rangel 2019-06-03 224
4c1ca625c622b7 Nick Crews 2019-04-16 225 static struct attribute *wilco_dev_attrs[] = {
4c1ca625c622b7 Nick Crews 2019-04-16 226 &dev_attr_boot_on_ac.attr,
79e3f1d3db3d99 Raul E Rangel 2019-06-03 @227 &dev_attr_build_date.attr,
79e3f1d3db3d99 Raul E Rangel 2019-06-03 @228 &dev_attr_build_revision.attr,
79e3f1d3db3d99 Raul E Rangel 2019-06-03 @229 &dev_attr_model_number.attr,
fdf0fe2df3e321 Daniel Campello 2019-10-08 @230 &dev_attr_usb_charge.attr,
79e3f1d3db3d99 Raul E Rangel 2019-06-03 @231 &dev_attr_version.attr,
4c1ca625c622b7 Nick Crews 2019-04-16 232 NULL,
4c1ca625c622b7 Nick Crews 2019-04-16 233 };
4c1ca625c622b7 Nick Crews 2019-04-16 234
:::::: The code at line 227 was first introduced by commit
:::::: 79e3f1d3db3d99ac7ae4f29b00da545df231a5a7 platform/chrome: wilco_ec: Add version sysfs entries
:::::: TO: Raul E Rangel <rrangel@...omium.org>
:::::: CC: Enric Balletbo i Serra <enric.balletbo@...labora.com>
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org Intel Corporation
Download attachment ".config.gz" of type "application/gzip" (32983 bytes)
Powered by blists - more mailing lists