@@ -89,9 +89,6 @@ static int kone_send(struct usb_device *usb_dev, uint usb_command,
8989 return ((len < 0 ) ? len : ((len != size ) ? - EIO : 0 ));
9090}
9191
92- /* kone_class is used for creating sysfs attributes via roccat char device */
93- static struct class * kone_class ;
94-
9592static void kone_set_settings_checksum (struct kone_settings * settings )
9693{
9794 uint16_t checksum = 0 ;
@@ -657,6 +654,12 @@ static const struct attribute_group *kone_groups[] = {
657654 NULL ,
658655};
659656
657+ /* kone_class is used for creating sysfs attributes via roccat char device */
658+ static const struct class kone_class = {
659+ .name = "kone" ,
660+ .dev_groups = kone_groups ,
661+ };
662+
660663static int kone_init_kone_device_struct (struct usb_device * usb_dev ,
661664 struct kone_device * kone )
662665{
@@ -712,8 +715,8 @@ static int kone_init_specials(struct hid_device *hdev)
712715 goto exit_free ;
713716 }
714717
715- retval = roccat_connect (kone_class , hdev ,
716- sizeof (struct kone_roccat_report ));
718+ retval = roccat_connect (& kone_class , hdev ,
719+ sizeof (struct kone_roccat_report ));
717720 if (retval < 0 ) {
718721 hid_err (hdev , "couldn't init char dev\n" );
719722 /* be tolerant about not getting chrdev */
@@ -890,21 +893,20 @@ static int __init kone_init(void)
890893 int retval ;
891894
892895 /* class name has to be same as driver name */
893- kone_class = class_create ("kone" );
894- if (IS_ERR (kone_class ))
895- return PTR_ERR (kone_class );
896- kone_class -> dev_groups = kone_groups ;
896+ retval = class_register (& kone_class );
897+ if (retval )
898+ return retval ;
897899
898900 retval = hid_register_driver (& kone_driver );
899901 if (retval )
900- class_destroy ( kone_class );
902+ class_unregister ( & kone_class );
901903 return retval ;
902904}
903905
904906static void __exit kone_exit (void )
905907{
906908 hid_unregister_driver (& kone_driver );
907- class_destroy ( kone_class );
909+ class_unregister ( & kone_class );
908910}
909911
910912module_init (kone_init );
0 commit comments