@@ -50,21 +50,7 @@ struct gvt_firmware_header {
50
50
51
51
#define dev_to_drm_minor (d ) dev_get_drvdata((d))
52
52
53
- static ssize_t
54
- gvt_firmware_read (struct file * filp , struct kobject * kobj ,
55
- struct bin_attribute * attr , char * buf ,
56
- loff_t offset , size_t count )
57
- {
58
- memcpy (buf , attr -> private + offset , count );
59
- return count ;
60
- }
61
-
62
- static struct bin_attribute firmware_attr = {
63
- .attr = {.name = "gvt_firmware" , .mode = (S_IRUSR )},
64
- .read = gvt_firmware_read ,
65
- .write = NULL ,
66
- .mmap = NULL ,
67
- };
53
+ static BIN_ATTR_SIMPLE_ADMIN_RO (gvt_firmware );
68
54
69
55
static int expose_firmware_sysfs (struct intel_gvt * gvt )
70
56
{
@@ -107,10 +93,10 @@ static int expose_firmware_sysfs(struct intel_gvt *gvt)
107
93
crc32_start = offsetof(struct gvt_firmware_header , version );
108
94
h -> crc32 = crc32_le (0 , firmware + crc32_start , size - crc32_start );
109
95
110
- firmware_attr .size = size ;
111
- firmware_attr .private = firmware ;
96
+ bin_attr_gvt_firmware .size = size ;
97
+ bin_attr_gvt_firmware .private = firmware ;
112
98
113
- ret = device_create_bin_file (& pdev -> dev , & firmware_attr );
99
+ ret = device_create_bin_file (& pdev -> dev , & bin_attr_gvt_firmware );
114
100
if (ret ) {
115
101
vfree (firmware );
116
102
return ret ;
@@ -122,8 +108,8 @@ static void clean_firmware_sysfs(struct intel_gvt *gvt)
122
108
{
123
109
struct pci_dev * pdev = to_pci_dev (gvt -> gt -> i915 -> drm .dev );
124
110
125
- device_remove_bin_file (& pdev -> dev , & firmware_attr );
126
- vfree (firmware_attr .private );
111
+ device_remove_bin_file (& pdev -> dev , & bin_attr_gvt_firmware );
112
+ vfree (bin_attr_gvt_firmware .private );
127
113
}
128
114
129
115
/**
0 commit comments