[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <201710141526.qGWaI7vj%fengguang.wu@intel.com>
Date: Sat, 14 Oct 2017 15:34:09 +0800
From: kbuild test robot <lkp@...el.com>
To: Bhumika Goyal <bhumirks@...il.com>
Cc: kbuild-all@...org, julia.lawall@...6.fr,
alexander.shishkin@...ux.intel.com, linux-kernel@...r.kernel.org,
Bhumika Goyal <bhumirks@...il.com>
Subject: Re: [PATCH] stm class: make config_item_type const
Hi Bhumika,
[auto build test WARNING on linus/master]
[also build test WARNING on v4.14-rc4 next-20171013]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Bhumika-Goyal/stm-class-make-config_item_type-const/20171014-144440
config: blackfin-allyesconfig (attached as .config)
compiler: bfin-uclinux-gcc (GCC) 6.2.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=blackfin
All warnings (new ones prefixed by >>):
drivers/hwtracing/stm/policy.c: In function 'stp_policy_node_make':
>> drivers/hwtracing/stm/policy.c:215:9: warning: passing argument 3 of 'config_group_init_type_name' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
&stp_policy_node_type);
^
In file included from drivers/hwtracing/stm/policy.c:23:0:
include/linux/configfs.h:102:13: note: expected 'struct config_item_type *' but argument is of type 'const struct config_item_type *'
extern void config_group_init_type_name(struct config_group *group,
^~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/hwtracing/stm/policy.c: In function 'stp_policies_make':
drivers/hwtracing/stm/policy.c:365:9: warning: passing argument 3 of 'config_group_init_type_name' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
&stp_policy_type);
^
In file included from drivers/hwtracing/stm/policy.c:23:0:
include/linux/configfs.h:102:13: note: expected 'struct config_item_type *' but argument is of type 'const struct config_item_type *'
extern void config_group_init_type_name(struct config_group *group,
^~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/hwtracing/stm/policy.c: At top level:
>> drivers/hwtracing/stm/policy.c:392:15: warning: initialization discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
.ci_type = &stp_policies_type,
^
vim +215 drivers/hwtracing/stm/policy.c
7bd1d4093 Alexander Shishkin 2015-09-22 192
7bd1d4093 Alexander Shishkin 2015-09-22 193 static struct config_group *
7bd1d4093 Alexander Shishkin 2015-09-22 194 stp_policy_node_make(struct config_group *group, const char *name)
7bd1d4093 Alexander Shishkin 2015-09-22 195 {
7bd1d4093 Alexander Shishkin 2015-09-22 196 struct stp_policy_node *policy_node, *parent_node;
7bd1d4093 Alexander Shishkin 2015-09-22 197 struct stp_policy *policy;
7bd1d4093 Alexander Shishkin 2015-09-22 198
7bd1d4093 Alexander Shishkin 2015-09-22 199 if (group->cg_item.ci_type == &stp_policy_type) {
7bd1d4093 Alexander Shishkin 2015-09-22 200 policy = container_of(group, struct stp_policy, group);
7bd1d4093 Alexander Shishkin 2015-09-22 201 } else {
7bd1d4093 Alexander Shishkin 2015-09-22 202 parent_node = container_of(group, struct stp_policy_node,
7bd1d4093 Alexander Shishkin 2015-09-22 203 group);
7bd1d4093 Alexander Shishkin 2015-09-22 204 policy = parent_node->policy;
7bd1d4093 Alexander Shishkin 2015-09-22 205 }
7bd1d4093 Alexander Shishkin 2015-09-22 206
7bd1d4093 Alexander Shishkin 2015-09-22 207 if (!policy->stm)
7bd1d4093 Alexander Shishkin 2015-09-22 208 return ERR_PTR(-ENODEV);
7bd1d4093 Alexander Shishkin 2015-09-22 209
7bd1d4093 Alexander Shishkin 2015-09-22 210 policy_node = kzalloc(sizeof(struct stp_policy_node), GFP_KERNEL);
7bd1d4093 Alexander Shishkin 2015-09-22 211 if (!policy_node)
7bd1d4093 Alexander Shishkin 2015-09-22 212 return ERR_PTR(-ENOMEM);
7bd1d4093 Alexander Shishkin 2015-09-22 213
7bd1d4093 Alexander Shishkin 2015-09-22 214 config_group_init_type_name(&policy_node->group, name,
7bd1d4093 Alexander Shishkin 2015-09-22 @215 &stp_policy_node_type);
7bd1d4093 Alexander Shishkin 2015-09-22 216
7bd1d4093 Alexander Shishkin 2015-09-22 217 policy_node->policy = policy;
7bd1d4093 Alexander Shishkin 2015-09-22 218
7bd1d4093 Alexander Shishkin 2015-09-22 219 /* default values for the attributes */
7bd1d4093 Alexander Shishkin 2015-09-22 220 policy_node->first_master = policy->stm->data->sw_start;
7bd1d4093 Alexander Shishkin 2015-09-22 221 policy_node->last_master = policy->stm->data->sw_end;
7bd1d4093 Alexander Shishkin 2015-09-22 222 policy_node->first_channel = 0;
7bd1d4093 Alexander Shishkin 2015-09-22 223 policy_node->last_channel = policy->stm->data->sw_nchannels - 1;
7bd1d4093 Alexander Shishkin 2015-09-22 224
7bd1d4093 Alexander Shishkin 2015-09-22 225 return &policy_node->group;
7bd1d4093 Alexander Shishkin 2015-09-22 226 }
7bd1d4093 Alexander Shishkin 2015-09-22 227
7bd1d4093 Alexander Shishkin 2015-09-22 228 static void
7bd1d4093 Alexander Shishkin 2015-09-22 229 stp_policy_node_drop(struct config_group *group, struct config_item *item)
7bd1d4093 Alexander Shishkin 2015-09-22 230 {
7bd1d4093 Alexander Shishkin 2015-09-22 231 config_item_put(item);
7bd1d4093 Alexander Shishkin 2015-09-22 232 }
7bd1d4093 Alexander Shishkin 2015-09-22 233
7bd1d4093 Alexander Shishkin 2015-09-22 234 static struct configfs_group_operations stp_policy_node_group_ops = {
7bd1d4093 Alexander Shishkin 2015-09-22 235 .make_group = stp_policy_node_make,
7bd1d4093 Alexander Shishkin 2015-09-22 236 .drop_item = stp_policy_node_drop,
7bd1d4093 Alexander Shishkin 2015-09-22 237 };
7bd1d4093 Alexander Shishkin 2015-09-22 238
4608771fe Bhumika Goyal 2017-10-12 239 static const struct config_item_type stp_policy_node_type = {
7bd1d4093 Alexander Shishkin 2015-09-22 240 .ct_item_ops = &stp_policy_node_item_ops,
7bd1d4093 Alexander Shishkin 2015-09-22 241 .ct_group_ops = &stp_policy_node_group_ops,
7bd1d4093 Alexander Shishkin 2015-09-22 242 .ct_attrs = stp_policy_node_attrs,
7bd1d4093 Alexander Shishkin 2015-09-22 243 .ct_owner = THIS_MODULE,
7bd1d4093 Alexander Shishkin 2015-09-22 244 };
7bd1d4093 Alexander Shishkin 2015-09-22 245
7bd1d4093 Alexander Shishkin 2015-09-22 246 /*
7bd1d4093 Alexander Shishkin 2015-09-22 247 * Root group: policies.
7bd1d4093 Alexander Shishkin 2015-09-22 248 */
9aa3d651a Linus Torvalds 2015-11-13 249 static ssize_t stp_policy_device_show(struct config_item *item,
7bd1d4093 Alexander Shishkin 2015-09-22 250 char *page)
7bd1d4093 Alexander Shishkin 2015-09-22 251 {
7bd1d4093 Alexander Shishkin 2015-09-22 252 struct stp_policy *policy = to_stp_policy(item);
7bd1d4093 Alexander Shishkin 2015-09-22 253 ssize_t count;
7bd1d4093 Alexander Shishkin 2015-09-22 254
7bd1d4093 Alexander Shishkin 2015-09-22 255 count = sprintf(page, "%s\n",
7bd1d4093 Alexander Shishkin 2015-09-22 256 (policy && policy->stm) ?
7bd1d4093 Alexander Shishkin 2015-09-22 257 policy->stm->data->name :
7bd1d4093 Alexander Shishkin 2015-09-22 258 "<none>");
7bd1d4093 Alexander Shishkin 2015-09-22 259
7bd1d4093 Alexander Shishkin 2015-09-22 260 return count;
7bd1d4093 Alexander Shishkin 2015-09-22 261 }
7bd1d4093 Alexander Shishkin 2015-09-22 262
9aa3d651a Linus Torvalds 2015-11-13 263 CONFIGFS_ATTR_RO(stp_policy_, device);
9aa3d651a Linus Torvalds 2015-11-13 264
9aa3d651a Linus Torvalds 2015-11-13 265 static struct configfs_attribute *stp_policy_attrs[] = {
9aa3d651a Linus Torvalds 2015-11-13 266 &stp_policy_attr_device,
9aa3d651a Linus Torvalds 2015-11-13 267 NULL,
9aa3d651a Linus Torvalds 2015-11-13 268 };
9aa3d651a Linus Torvalds 2015-11-13 269
7bd1d4093 Alexander Shishkin 2015-09-22 270 void stp_policy_unbind(struct stp_policy *policy)
7bd1d4093 Alexander Shishkin 2015-09-22 271 {
7bd1d4093 Alexander Shishkin 2015-09-22 272 struct stm_device *stm = policy->stm;
7bd1d4093 Alexander Shishkin 2015-09-22 273
4c127fd16 Alexander Shishkin 2015-12-22 274 /*
4c127fd16 Alexander Shishkin 2015-12-22 275 * stp_policy_release() will not call here if the policy is already
4c127fd16 Alexander Shishkin 2015-12-22 276 * unbound; other users should not either, as no link exists between
4c127fd16 Alexander Shishkin 2015-12-22 277 * this policy and anything else in that case
4c127fd16 Alexander Shishkin 2015-12-22 278 */
7bd1d4093 Alexander Shishkin 2015-09-22 279 if (WARN_ON_ONCE(!policy->stm))
7bd1d4093 Alexander Shishkin 2015-09-22 280 return;
7bd1d4093 Alexander Shishkin 2015-09-22 281
4c127fd16 Alexander Shishkin 2015-12-22 282 lockdep_assert_held(&stm->policy_mutex);
7bd1d4093 Alexander Shishkin 2015-09-22 283
4c127fd16 Alexander Shishkin 2015-12-22 284 stm->policy = NULL;
7bd1d4093 Alexander Shishkin 2015-09-22 285 policy->stm = NULL;
7bd1d4093 Alexander Shishkin 2015-09-22 286
7bd1d4093 Alexander Shishkin 2015-09-22 287 stm_put_device(stm);
7bd1d4093 Alexander Shishkin 2015-09-22 288 }
7bd1d4093 Alexander Shishkin 2015-09-22 289
7bd1d4093 Alexander Shishkin 2015-09-22 290 static void stp_policy_release(struct config_item *item)
7bd1d4093 Alexander Shishkin 2015-09-22 291 {
7bd1d4093 Alexander Shishkin 2015-09-22 292 struct stp_policy *policy = to_stp_policy(item);
4c127fd16 Alexander Shishkin 2015-12-22 293 struct stm_device *stm = policy->stm;
7bd1d4093 Alexander Shishkin 2015-09-22 294
4c127fd16 Alexander Shishkin 2015-12-22 295 /* a policy *can* be unbound and still exist in configfs tree */
4c127fd16 Alexander Shishkin 2015-12-22 296 if (!stm)
4c127fd16 Alexander Shishkin 2015-12-22 297 return;
4c127fd16 Alexander Shishkin 2015-12-22 298
4c127fd16 Alexander Shishkin 2015-12-22 299 mutex_lock(&stm->policy_mutex);
7bd1d4093 Alexander Shishkin 2015-09-22 300 stp_policy_unbind(policy);
4c127fd16 Alexander Shishkin 2015-12-22 301 mutex_unlock(&stm->policy_mutex);
4c127fd16 Alexander Shishkin 2015-12-22 302
7bd1d4093 Alexander Shishkin 2015-09-22 303 kfree(policy);
7bd1d4093 Alexander Shishkin 2015-09-22 304 }
7bd1d4093 Alexander Shishkin 2015-09-22 305
7bd1d4093 Alexander Shishkin 2015-09-22 306 static struct configfs_item_operations stp_policy_item_ops = {
7bd1d4093 Alexander Shishkin 2015-09-22 307 .release = stp_policy_release,
7bd1d4093 Alexander Shishkin 2015-09-22 308 };
7bd1d4093 Alexander Shishkin 2015-09-22 309
7bd1d4093 Alexander Shishkin 2015-09-22 310 static struct configfs_group_operations stp_policy_group_ops = {
7bd1d4093 Alexander Shishkin 2015-09-22 311 .make_group = stp_policy_node_make,
7bd1d4093 Alexander Shishkin 2015-09-22 312 };
7bd1d4093 Alexander Shishkin 2015-09-22 313
4608771fe Bhumika Goyal 2017-10-12 314 static const struct config_item_type stp_policy_type = {
7bd1d4093 Alexander Shishkin 2015-09-22 315 .ct_item_ops = &stp_policy_item_ops,
7bd1d4093 Alexander Shishkin 2015-09-22 316 .ct_group_ops = &stp_policy_group_ops,
7bd1d4093 Alexander Shishkin 2015-09-22 317 .ct_attrs = stp_policy_attrs,
7bd1d4093 Alexander Shishkin 2015-09-22 318 .ct_owner = THIS_MODULE,
7bd1d4093 Alexander Shishkin 2015-09-22 319 };
7bd1d4093 Alexander Shishkin 2015-09-22 320
7bd1d4093 Alexander Shishkin 2015-09-22 321 static struct config_group *
7bd1d4093 Alexander Shishkin 2015-09-22 322 stp_policies_make(struct config_group *group, const char *name)
7bd1d4093 Alexander Shishkin 2015-09-22 323 {
7bd1d4093 Alexander Shishkin 2015-09-22 324 struct config_group *ret;
7bd1d4093 Alexander Shishkin 2015-09-22 325 struct stm_device *stm;
7bd1d4093 Alexander Shishkin 2015-09-22 326 char *devname, *p;
7bd1d4093 Alexander Shishkin 2015-09-22 327
7bd1d4093 Alexander Shishkin 2015-09-22 328 devname = kasprintf(GFP_KERNEL, "%s", name);
7bd1d4093 Alexander Shishkin 2015-09-22 329 if (!devname)
7bd1d4093 Alexander Shishkin 2015-09-22 330 return ERR_PTR(-ENOMEM);
7bd1d4093 Alexander Shishkin 2015-09-22 331
7bd1d4093 Alexander Shishkin 2015-09-22 332 /*
7bd1d4093 Alexander Shishkin 2015-09-22 333 * node must look like <device_name>.<policy_name>, where
59be422e4 Alexander Shishkin 2016-02-15 334 * <device_name> is the name of an existing stm device; may
59be422e4 Alexander Shishkin 2016-02-15 335 * contain dots;
59be422e4 Alexander Shishkin 2016-02-15 336 * <policy_name> is an arbitrary string; may not contain dots
7bd1d4093 Alexander Shishkin 2015-09-22 337 */
59be422e4 Alexander Shishkin 2016-02-15 338 p = strrchr(devname, '.');
7bd1d4093 Alexander Shishkin 2015-09-22 339 if (!p) {
7bd1d4093 Alexander Shishkin 2015-09-22 340 kfree(devname);
7bd1d4093 Alexander Shishkin 2015-09-22 341 return ERR_PTR(-EINVAL);
7bd1d4093 Alexander Shishkin 2015-09-22 342 }
7bd1d4093 Alexander Shishkin 2015-09-22 343
fb0801904 Alexander Shishkin 2016-03-04 344 *p = '\0';
7bd1d4093 Alexander Shishkin 2015-09-22 345
7bd1d4093 Alexander Shishkin 2015-09-22 346 stm = stm_find_device(devname);
7bd1d4093 Alexander Shishkin 2015-09-22 347 kfree(devname);
7bd1d4093 Alexander Shishkin 2015-09-22 348
7bd1d4093 Alexander Shishkin 2015-09-22 349 if (!stm)
7bd1d4093 Alexander Shishkin 2015-09-22 350 return ERR_PTR(-ENODEV);
7bd1d4093 Alexander Shishkin 2015-09-22 351
7bd1d4093 Alexander Shishkin 2015-09-22 352 mutex_lock(&stm->policy_mutex);
7bd1d4093 Alexander Shishkin 2015-09-22 353 if (stm->policy) {
7bd1d4093 Alexander Shishkin 2015-09-22 354 ret = ERR_PTR(-EBUSY);
7bd1d4093 Alexander Shishkin 2015-09-22 355 goto unlock_policy;
7bd1d4093 Alexander Shishkin 2015-09-22 356 }
7bd1d4093 Alexander Shishkin 2015-09-22 357
7bd1d4093 Alexander Shishkin 2015-09-22 358 stm->policy = kzalloc(sizeof(*stm->policy), GFP_KERNEL);
7bd1d4093 Alexander Shishkin 2015-09-22 359 if (!stm->policy) {
7bd1d4093 Alexander Shishkin 2015-09-22 360 ret = ERR_PTR(-ENOMEM);
7bd1d4093 Alexander Shishkin 2015-09-22 361 goto unlock_policy;
7bd1d4093 Alexander Shishkin 2015-09-22 362 }
7bd1d4093 Alexander Shishkin 2015-09-22 363
7bd1d4093 Alexander Shishkin 2015-09-22 364 config_group_init_type_name(&stm->policy->group, name,
7bd1d4093 Alexander Shishkin 2015-09-22 @365 &stp_policy_type);
7bd1d4093 Alexander Shishkin 2015-09-22 366 stm->policy->stm = stm;
7bd1d4093 Alexander Shishkin 2015-09-22 367
7bd1d4093 Alexander Shishkin 2015-09-22 368 ret = &stm->policy->group;
7bd1d4093 Alexander Shishkin 2015-09-22 369
7bd1d4093 Alexander Shishkin 2015-09-22 370 unlock_policy:
7bd1d4093 Alexander Shishkin 2015-09-22 371 mutex_unlock(&stm->policy_mutex);
7bd1d4093 Alexander Shishkin 2015-09-22 372
7bd1d4093 Alexander Shishkin 2015-09-22 373 if (IS_ERR(ret))
7bd1d4093 Alexander Shishkin 2015-09-22 374 stm_put_device(stm);
7bd1d4093 Alexander Shishkin 2015-09-22 375
7bd1d4093 Alexander Shishkin 2015-09-22 376 return ret;
7bd1d4093 Alexander Shishkin 2015-09-22 377 }
7bd1d4093 Alexander Shishkin 2015-09-22 378
7bd1d4093 Alexander Shishkin 2015-09-22 379 static struct configfs_group_operations stp_policies_group_ops = {
7bd1d4093 Alexander Shishkin 2015-09-22 380 .make_group = stp_policies_make,
7bd1d4093 Alexander Shishkin 2015-09-22 381 };
7bd1d4093 Alexander Shishkin 2015-09-22 382
4608771fe Bhumika Goyal 2017-10-12 383 static const struct config_item_type stp_policies_type = {
7bd1d4093 Alexander Shishkin 2015-09-22 384 .ct_group_ops = &stp_policies_group_ops,
7bd1d4093 Alexander Shishkin 2015-09-22 385 .ct_owner = THIS_MODULE,
7bd1d4093 Alexander Shishkin 2015-09-22 386 };
7bd1d4093 Alexander Shishkin 2015-09-22 387
7bd1d4093 Alexander Shishkin 2015-09-22 388 static struct configfs_subsystem stp_policy_subsys = {
7bd1d4093 Alexander Shishkin 2015-09-22 389 .su_group = {
7bd1d4093 Alexander Shishkin 2015-09-22 390 .cg_item = {
7bd1d4093 Alexander Shishkin 2015-09-22 391 .ci_namebuf = "stp-policy",
7bd1d4093 Alexander Shishkin 2015-09-22 @392 .ci_type = &stp_policies_type,
7bd1d4093 Alexander Shishkin 2015-09-22 393 },
7bd1d4093 Alexander Shishkin 2015-09-22 394 },
7bd1d4093 Alexander Shishkin 2015-09-22 395 };
7bd1d4093 Alexander Shishkin 2015-09-22 396
:::::: The code at line 215 was first introduced by commit
:::::: 7bd1d4093c2fa37d1ecab05da3c9d48ea2af2264 stm class: Introduce an abstraction for System Trace Module devices
:::::: TO: Alexander Shishkin <alexander.shishkin@...ux.intel.com>
:::::: CC: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
Download attachment ".config.gz" of type "application/gzip" (46054 bytes)
Powered by blists - more mailing lists