@@ -52,7 +52,7 @@ static ssize_t size_show(struct kobject *kobj, struct kobj_attribute *attr,
5252}
5353
5454static ssize_t data_read (struct file * filep , struct kobject * kobj ,
55- struct bin_attribute * attr , char * buf , loff_t off ,
55+ const struct bin_attribute * attr , char * buf , loff_t off ,
5656 size_t count )
5757{
5858 char * data ;
@@ -85,7 +85,7 @@ static ssize_t data_read(struct file *filep, struct kobject *kobj,
8585}
8686
8787static ssize_t update_write (struct file * filep , struct kobject * kobj ,
88- struct bin_attribute * attr , char * buf , loff_t off ,
88+ const struct bin_attribute * attr , char * buf , loff_t off ,
8989 size_t count )
9090{
9191 int rc ;
@@ -104,11 +104,11 @@ static struct kobj_attribute format_attr = __ATTR_RO(format);
104104
105105static struct kobj_attribute size_attr = __ATTR_RO (size );
106106
107- static struct bin_attribute data_attr = __BIN_ATTR_RO (data , 0 );
107+ static struct bin_attribute data_attr __ro_after_init = __BIN_ATTR_RO (data , 0 );
108108
109- static struct bin_attribute update_attr = __BIN_ATTR_WO (update , 0 );
109+ static struct bin_attribute update_attr __ro_after_init = __BIN_ATTR_WO (update , 0 );
110110
111- static struct bin_attribute * secvar_bin_attrs [] = {
111+ static const struct bin_attribute * const secvar_bin_attrs [] = {
112112 & data_attr ,
113113 & update_attr ,
114114 NULL ,
@@ -121,7 +121,7 @@ static struct attribute *secvar_attrs[] = {
121121
122122static const struct attribute_group secvar_attr_group = {
123123 .attrs = secvar_attrs ,
124- .bin_attrs = secvar_bin_attrs ,
124+ .bin_attrs_new = secvar_bin_attrs ,
125125};
126126__ATTRIBUTE_GROUPS (secvar_attr );
127127
@@ -130,7 +130,7 @@ static const struct kobj_type secvar_ktype = {
130130 .default_groups = secvar_attr_groups ,
131131};
132132
133- static int update_kobj_size (void )
133+ static __init int update_kobj_size (void )
134134{
135135
136136 u64 varsize ;
@@ -145,7 +145,7 @@ static int update_kobj_size(void)
145145 return 0 ;
146146}
147147
148- static int secvar_sysfs_config (struct kobject * kobj )
148+ static __init int secvar_sysfs_config (struct kobject * kobj )
149149{
150150 struct attribute_group config_group = {
151151 .name = "config" ,
@@ -158,7 +158,7 @@ static int secvar_sysfs_config(struct kobject *kobj)
158158 return 0 ;
159159}
160160
161- static int add_var (const char * name )
161+ static __init int add_var (const char * name )
162162{
163163 struct kobject * kobj ;
164164 int rc ;
@@ -181,7 +181,7 @@ static int add_var(const char *name)
181181 return 0 ;
182182}
183183
184- static int secvar_sysfs_load (void )
184+ static __init int secvar_sysfs_load (void )
185185{
186186 u64 namesize = 0 ;
187187 char * name ;
@@ -209,7 +209,7 @@ static int secvar_sysfs_load(void)
209209 return rc ;
210210}
211211
212- static int secvar_sysfs_load_static (void )
212+ static __init int secvar_sysfs_load_static (void )
213213{
214214 const char * const * name_ptr = secvar_ops -> var_names ;
215215 int rc ;
@@ -224,7 +224,7 @@ static int secvar_sysfs_load_static(void)
224224 return 0 ;
225225}
226226
227- static int secvar_sysfs_init (void )
227+ static __init int secvar_sysfs_init (void )
228228{
229229 u64 max_size ;
230230 int rc ;
0 commit comments