[ogabbay:accel 1/2] drivers/accelerators/accel_sysfs.c:66:5: warning: no previous prototype for 'accel_sysfs_init'

From: kernel test robot
Date: Wed Aug 10 2022 - 08:57:37 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/ogabbay/linux.git accel
head: 7cd6e545486f8ead2f046747a9557f62e8bbfff3
commit: ddc47a3f6a4387c32ae88c644a65529533f28d96 [1/2] accel: initial commit
config: i386-allyesconfig (https://download.01.org/0day-ci/archive/20220810/202208102011.HntMqTCc-lkp@xxxxxxxxx/config)
compiler: gcc-11 (Debian 11.3.0-3) 11.3.0
reproduce (this is a W=1 build):
# https://git.kernel.org/pub/scm/linux/kernel/git/ogabbay/linux.git/commit/?id=ddc47a3f6a4387c32ae88c644a65529533f28d96
git remote add ogabbay https://git.kernel.org/pub/scm/linux/kernel/git/ogabbay/linux.git
git fetch --no-tags ogabbay accel
git checkout ddc47a3f6a4387c32ae88c644a65529533f28d96
# save the config file
mkdir build_dir && cp config build_dir/.config
make W=1 O=build_dir ARCH=i386 SHELL=/bin/bash drivers/accelerators/

If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <lkp@xxxxxxxxx>

All warnings (new ones prefixed by >>):

>> drivers/accelerators/accel_sysfs.c:66:5: warning: no previous prototype for 'accel_sysfs_init' [-Wmissing-prototypes]
66 | int accel_sysfs_init(void)
| ^~~~~~~~~~~~~~~~
>> drivers/accelerators/accel_sysfs.c:91:6: warning: no previous prototype for 'accel_sysfs_destroy' [-Wmissing-prototypes]
91 | void accel_sysfs_destroy(void)
| ^~~~~~~~~~~~~~~~~~~
>> drivers/accelerators/accel_sysfs.c:105:16: warning: no previous prototype for 'accel_sysfs_minor_alloc' [-Wmissing-prototypes]
105 | struct device *accel_sysfs_minor_alloc(struct accel_minor *minor)
| ^~~~~~~~~~~~~~~~~~~~~~~


vim +/accel_sysfs_init +66 drivers/accelerators/accel_sysfs.c

55
56 /**
57 * accel_sysfs_init - initialize sysfs helpers
58 *
59 * This is used to create the ACCEL class, which is the implicit parent of any
60 * other top-level ACCEL sysfs objects.
61 *
62 * You must call accel_sysfs_destroy() to release the allocated resources.
63 *
64 * Return: 0 on success, negative error code on failure.
65 */
> 66 int accel_sysfs_init(void)
67 {
68 int err;
69
70 accel_class = class_create(THIS_MODULE, "accel");
71 if (IS_ERR(accel_class))
72 return PTR_ERR(accel_class);
73
74 err = class_create_file(accel_class, &class_attr_version.attr);
75 if (err) {
76 class_destroy(accel_class);
77 accel_class = NULL;
78 return err;
79 }
80
81 accel_class->devnode = accel_devnode;
82
83 return 0;
84 }
85
86 /**
87 * accel_sysfs_destroy - destroys ACCEL class
88 *
89 * Destroy the ACCEL device class.
90 */
> 91 void accel_sysfs_destroy(void)
92 {
93 if (IS_ERR_OR_NULL(accel_class))
94 return;
95 class_remove_file(accel_class, &class_attr_version.attr);
96 class_destroy(accel_class);
97 accel_class = NULL;
98 }
99
100 static void accel_sysfs_release(struct device *dev)
101 {
102 kfree(dev);
103 }
104
> 105 struct device *accel_sysfs_minor_alloc(struct accel_minor *minor)
106 {
107 const char *minor_str;
108 struct device *kdev;
109 int r;
110
111 if (minor->type == ACCEL_MINOR_CONTROL)
112 minor_str = "ac_ControlD%d";
113 else
114 minor_str = "ac%d";
115
116 kdev = kzalloc(sizeof(*kdev), GFP_KERNEL);
117 if (!kdev)
118 return ERR_PTR(-ENOMEM);
119
120 device_initialize(kdev);
121 kdev->devt = MKDEV(ACCEL_MAJOR, minor->index);
122 kdev->class = accel_class;
123 kdev->type = &accel_sysfs_device_minor;
124 kdev->parent = minor->dev->dev;
125 kdev->release = accel_sysfs_release;
126 dev_set_drvdata(kdev, minor);
127
128 r = dev_set_name(kdev, minor_str, minor->index);
129 if (r < 0)
130 goto err_free;
131
132 return kdev;
133
134 err_free:
135 put_device(kdev);
136 return ERR_PTR(r);
137 }
138

--
0-DAY CI Kernel Test Service
https://01.org/lkp