@@ -849,27 +849,6 @@ static const struct attribute_group *ubd_attr_groups[] = {
849
849
NULL ,
850
850
};
851
851
852
- static int ubd_disk_register (int major , u64 size , int unit ,
853
- struct gendisk * disk )
854
- {
855
- disk -> major = major ;
856
- disk -> first_minor = unit << UBD_SHIFT ;
857
- disk -> minors = 1 << UBD_SHIFT ;
858
- disk -> fops = & ubd_blops ;
859
- set_capacity (disk , size / 512 );
860
- sprintf (disk -> disk_name , "ubd%c" , 'a' + unit );
861
-
862
- ubd_devs [unit ].pdev .id = unit ;
863
- ubd_devs [unit ].pdev .name = DRIVER_NAME ;
864
- ubd_devs [unit ].pdev .dev .release = ubd_device_release ;
865
- dev_set_drvdata (& ubd_devs [unit ].pdev .dev , & ubd_devs [unit ]);
866
- platform_device_register (& ubd_devs [unit ].pdev );
867
-
868
- disk -> private_data = & ubd_devs [unit ];
869
- disk -> queue = ubd_devs [unit ].queue ;
870
- return device_add_disk (& ubd_devs [unit ].pdev .dev , disk , ubd_attr_groups );
871
- }
872
-
873
852
#define ROUND_BLOCK (n ) ((n + (SECTOR_SIZE - 1)) & (-SECTOR_SIZE))
874
853
875
854
static const struct blk_mq_ops ubd_mq_ops = {
@@ -916,7 +895,21 @@ static int ubd_add(int n, char **error_out)
916
895
ubd_dev -> queue = disk -> queue ;
917
896
918
897
blk_queue_write_cache (ubd_dev -> queue , true, false);
919
- err = ubd_disk_register (UBD_MAJOR , ubd_dev -> size , n , disk );
898
+ disk -> major = UBD_MAJOR ;
899
+ disk -> first_minor = n << UBD_SHIFT ;
900
+ disk -> minors = 1 << UBD_SHIFT ;
901
+ disk -> fops = & ubd_blops ;
902
+ set_capacity (disk , ubd_dev -> size / 512 );
903
+ sprintf (disk -> disk_name , "ubd%c" , 'a' + n );
904
+ disk -> private_data = ubd_dev ;
905
+
906
+ ubd_dev -> pdev .id = n ;
907
+ ubd_dev -> pdev .name = DRIVER_NAME ;
908
+ ubd_dev -> pdev .dev .release = ubd_device_release ;
909
+ dev_set_drvdata (& ubd_dev -> pdev .dev , ubd_dev );
910
+ platform_device_register (& ubd_dev -> pdev );
911
+
912
+ err = device_add_disk (& ubd_dev -> pdev .dev , disk , ubd_attr_groups );
920
913
if (err )
921
914
goto out_cleanup_disk ;
922
915
0 commit comments