@@ -162,7 +162,8 @@ static struct miscdevice rng_miscdev = {
162162};
163163
164164
165- static ssize_t hwrng_attr_current_store (struct class_device * class ,
165+ static ssize_t hwrng_attr_current_store (struct device * dev ,
166+ struct device_attribute * attr ,
166167 const char * buf , size_t len )
167168{
168169 int err ;
@@ -192,7 +193,8 @@ static ssize_t hwrng_attr_current_store(struct class_device *class,
192193 return err ? : len ;
193194}
194195
195- static ssize_t hwrng_attr_current_show (struct class_device * class ,
196+ static ssize_t hwrng_attr_current_show (struct device * dev ,
197+ struct device_attribute * attr ,
196198 char * buf )
197199{
198200 int err ;
@@ -210,7 +212,8 @@ static ssize_t hwrng_attr_current_show(struct class_device *class,
210212 return ret ;
211213}
212214
213- static ssize_t hwrng_attr_available_show (struct class_device * class ,
215+ static ssize_t hwrng_attr_available_show (struct device * dev ,
216+ struct device_attribute * attr ,
214217 char * buf )
215218{
216219 int err ;
@@ -234,20 +237,18 @@ static ssize_t hwrng_attr_available_show(struct class_device *class,
234237 return ret ;
235238}
236239
237- static CLASS_DEVICE_ATTR (rng_current , S_IRUGO | S_IWUSR ,
238- hwrng_attr_current_show ,
239- hwrng_attr_current_store ) ;
240- static CLASS_DEVICE_ATTR (rng_available , S_IRUGO ,
241- hwrng_attr_available_show ,
242- NULL) ;
240+ static DEVICE_ATTR (rng_current , S_IRUGO | S_IWUSR ,
241+ hwrng_attr_current_show ,
242+ hwrng_attr_current_store ) ;
243+ static DEVICE_ATTR (rng_available , S_IRUGO ,
244+ hwrng_attr_available_show ,
245+ NULL) ;
243246
244247
245248static void unregister_miscdev (void )
246249{
247- class_device_remove_file (rng_miscdev .class ,
248- & class_device_attr_rng_available );
249- class_device_remove_file (rng_miscdev .class ,
250- & class_device_attr_rng_current );
250+ device_remove_file (rng_miscdev .this_device , & dev_attr_rng_available );
251+ device_remove_file (rng_miscdev .this_device , & dev_attr_rng_current );
251252 misc_deregister (& rng_miscdev );
252253}
253254
@@ -258,20 +259,19 @@ static int register_miscdev(void)
258259 err = misc_register (& rng_miscdev );
259260 if (err )
260261 goto out ;
261- err = class_device_create_file (rng_miscdev .class ,
262- & class_device_attr_rng_current );
262+ err = device_create_file (rng_miscdev .this_device ,
263+ & dev_attr_rng_current );
263264 if (err )
264265 goto err_misc_dereg ;
265- err = class_device_create_file (rng_miscdev .class ,
266- & class_device_attr_rng_available );
266+ err = device_create_file (rng_miscdev .this_device ,
267+ & dev_attr_rng_available );
267268 if (err )
268269 goto err_remove_current ;
269270out :
270271 return err ;
271272
272273err_remove_current :
273- class_device_remove_file (rng_miscdev .class ,
274- & class_device_attr_rng_current );
274+ device_remove_file (rng_miscdev .this_device , & dev_attr_rng_current );
275275err_misc_dereg :
276276 misc_deregister (& rng_miscdev );
277277 goto out ;
0 commit comments