[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <201806181310.xIqT93Aa%fengguang.wu@intel.com>
Date: Mon, 18 Jun 2018 13:22:16 +0800
From: kbuild test robot <lkp@...el.com>
To: Wei Li <liwei1412@....com>
Cc: kbuild-all@...org, andrew@...n.ch, f.fainelli@...il.com,
netdev@...r.kernel.org
Subject: Re: [PATCH 1/2] eth phy: add mdio bus char device interface
Hi Wei,
I love your patch! Yet something to improve:
[auto build test ERROR on net-next/master]
[also build test ERROR on v4.18-rc1 next-20180615]
[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/Wei-Li/eth-phy-add-mdio-bus-char-device-interface/20180618-115206
config: xtensa-allmodconfig (attached as .config)
compiler: xtensa-linux-gcc (GCC) 8.1.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
GCC_VERSION=8.1.0 make.cross ARCH=xtensa
Note: the linux-review/Wei-Li/eth-phy-add-mdio-bus-char-device-interface/20180618-115206 HEAD 611497ceadd8527fc1e4aa0eb8936171906118dd builds fine.
It only hurts bisectibility.
All errors (new ones prefixed by >>):
drivers/net/phy/mdio-dev.c: In function 'mdiodev_attach_bus':
>> drivers/net/phy/mdio-dev.c:250:21: error: 'mdio_bus_class' undeclared (first use in this function); did you mean 'mdio_dev_class'?
if (dev->class != &mdio_bus_class)
^~~~~~~~~~~~~~
mdio_dev_class
drivers/net/phy/mdio-dev.c:250:21: note: each undeclared identifier is reported only once for each function it appears in
drivers/net/phy/mdio-dev.c: In function 'mdiodev_detach_bus':
drivers/net/phy/mdio-dev.c:288:21: error: 'mdio_bus_class' undeclared (first use in this function); did you mean 'mdio_dev_class'?
if (dev->class != &mdio_bus_class)
^~~~~~~~~~~~~~
mdio_dev_class
drivers/net/phy/mdio-dev.c: In function 'mdio_dev_init':
>> drivers/net/phy/mdio-dev.c:345:8: error: implicit declaration of function 'mdiobus_register_notifier'; did you mean 'bus_register_notifier'? [-Werror=implicit-function-declaration]
res = mdiobus_register_notifier(&mdiodev_notifier);
^~~~~~~~~~~~~~~~~~~~~~~~~
bus_register_notifier
drivers/net/phy/mdio-dev.c:350:25: error: 'mdio_bus_class' undeclared (first use in this function); did you mean 'mdio_dev_class'?
class_for_each_device(&mdio_bus_class, NULL, NULL, mdiodev_attach_bus);
^~~~~~~~~~~~~~
mdio_dev_class
drivers/net/phy/mdio-dev.c: In function 'mdio_dev_exit':
>> drivers/net/phy/mdio-dev.c:365:2: error: implicit declaration of function 'mdiobus_unregister_notifier'; did you mean 'bus_unregister_notifier'? [-Werror=implicit-function-declaration]
mdiobus_unregister_notifier(&mdiodev_notifier);
^~~~~~~~~~~~~~~~~~~~~~~~~~~
bus_unregister_notifier
drivers/net/phy/mdio-dev.c:366:25: error: 'mdio_bus_class' undeclared (first use in this function); did you mean 'mdio_dev_class'?
class_for_each_device(&mdio_bus_class, NULL, NULL, mdiodev_detach_bus);
^~~~~~~~~~~~~~
mdio_dev_class
cc1: some warnings being treated as errors
vim +250 drivers/net/phy/mdio-dev.c
243
244 static int mdiodev_attach_bus(struct device *dev, void *dummy)
245 {
246 struct mii_bus *bus;
247 struct mdio_dev *mdio_dev;
248 int res;
249
> 250 if (dev->class != &mdio_bus_class)
251 return 0;
252 bus = to_mii_bus(dev);
253
254 mdio_dev = get_free_mdio_dev(bus);
255 if (IS_ERR(mdio_dev))
256 return PTR_ERR(mdio_dev);
257
258 cdev_init(&mdio_dev->cdev, &mdiodev_fops);
259 mdio_dev->cdev.owner = THIS_MODULE;
260 res = cdev_add(&mdio_dev->cdev, MKDEV(mdio_major, mdio_dev->nr), 1);
261 if (res)
262 goto error_cdev;
263
264 /* register this mdio device with the driver core */
265 mdio_dev->dev = device_create(mdio_dev_class, &bus->dev,
266 MKDEV(mdio_major, mdio_dev->nr), NULL,
267 "mdio-%d", mdio_dev->nr);
268 if (IS_ERR(mdio_dev->dev)) {
269 res = PTR_ERR(mdio_dev->dev);
270 goto error;
271 }
272
273 pr_debug("mdio-dev: bus [%s] registered as minor %d\n",
274 bus->name, mdio_dev->nr);
275 return 0;
276 error:
277 cdev_del(&mdio_dev->cdev);
278 error_cdev:
279 put_mdio_dev(mdio_dev);
280 return res;
281 }
282
283 static int mdiodev_detach_bus(struct device *dev, void *dummy)
284 {
285 struct mii_bus *bus;
286 struct mdio_dev *mdio_dev;
287
288 if (dev->class != &mdio_bus_class)
289 return 0;
290 bus = to_mii_bus(dev);
291
292 mdio_dev = mdio_dev_get_by_bus(bus);
293 if (!mdio_dev) /* attach_bus must have failed */
294 return 0;
295
296 cdev_del(&mdio_dev->cdev);
297 device_destroy(mdio_dev_class, MKDEV(mdio_major, mdio_dev->nr));
298 put_mdio_dev(mdio_dev);
299
300 pr_debug("mdio-dev: bus [%s] unregistered\n", bus->name);
301 return 0;
302 }
303
304 static int mdiodev_notifier_call(struct notifier_block *nb, unsigned long action,
305 void *data)
306 {
307 struct device *dev = data;
308
309 switch (action) {
310 case BUS_NOTIFY_ADD_DEVICE:
311 return mdiodev_attach_bus(dev, NULL);
312 case BUS_NOTIFY_DEL_DEVICE:
313 return mdiodev_detach_bus(dev, NULL);
314 }
315
316 return 0;
317 }
318
319 static struct notifier_block mdiodev_notifier = {
320 .notifier_call = mdiodev_notifier_call,
321 };
322
323 /*-------------------------------------------------------------------------*/
324
325 static int __init mdio_dev_init(void)
326 {
327 int res;
328 dev_t devid;
329
330 printk(KERN_INFO "mdio /dev entries driver\n");
331
332 res = alloc_chrdev_region(&devid, 0, MDIO_MINORS, "mdio");
333 if (res)
334 goto out;
335
336 mdio_major = MAJOR(devid);
337 mdio_dev_class = class_create(THIS_MODULE, "mdio-dev");
338 if (IS_ERR(mdio_dev_class)) {
339 res = PTR_ERR(mdio_dev_class);
340 goto out_unreg_chrdev;
341 }
342 mdio_dev_class->dev_groups = mdio_groups;
343
344 /* Keep track of buses which will be added or removed later */
> 345 res = mdiobus_register_notifier(&mdiodev_notifier);
346 if (res)
347 goto out_unreg_class;
348
349 /* Bind to already existing buses right away */
350 class_for_each_device(&mdio_bus_class, NULL, NULL, mdiodev_attach_bus);
351
352 return 0;
353
354 out_unreg_class:
355 class_destroy(mdio_dev_class);
356 out_unreg_chrdev:
357 unregister_chrdev_region(MKDEV(mdio_major, 0), MDIO_MINORS);
358 out:
359 printk(KERN_ERR "%s: Driver Initialisation failed\n", __FILE__);
360 return res;
361 }
362
363 static void __exit mdio_dev_exit(void)
364 {
> 365 mdiobus_unregister_notifier(&mdiodev_notifier);
366 class_for_each_device(&mdio_bus_class, NULL, NULL, mdiodev_detach_bus);
367 class_destroy(mdio_dev_class);
368 unregister_chrdev_region(MKDEV(mdio_major, 0), MDIO_MINORS);
369 }
370
---
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" (53907 bytes)
Powered by blists - more mailing lists