@@ -66,8 +66,9 @@ struct pmt_crashlog_priv {
66
66
*/
67
67
68
68
/* Read, modify, write the control register, setting or clearing @bit based on @set */
69
- static void pmt_crashlog_rmw (struct intel_pmt_entry * entry , u32 bit , bool set )
69
+ static void pmt_crashlog_rmw (struct crashlog_entry * crashlog , u32 bit , bool set )
70
70
{
71
+ struct intel_pmt_entry * entry = & crashlog -> entry ;
71
72
u32 reg = readl (entry -> disc_table + CONTROL_OFFSET );
72
73
73
74
reg &= ~CRASHLOG_FLAG_TRIGGER_MASK ;
@@ -81,23 +82,24 @@ static void pmt_crashlog_rmw(struct intel_pmt_entry *entry, u32 bit, bool set)
81
82
}
82
83
83
84
/* Read the status register and see if the specified @bit is set */
84
- static bool pmt_crashlog_rc (struct intel_pmt_entry * entry , u32 bit )
85
+ static bool pmt_crashlog_rc (struct crashlog_entry * crashlog , u32 bit )
85
86
{
87
+ struct intel_pmt_entry * entry = & crashlog -> entry ;
86
88
u32 reg = readl (entry -> disc_table + CONTROL_OFFSET );
87
89
88
90
return !!(reg & bit );
89
91
}
90
92
91
- static bool pmt_crashlog_complete (struct intel_pmt_entry * entry )
93
+ static bool pmt_crashlog_complete (struct crashlog_entry * crashlog )
92
94
{
93
95
/* return current value of the crashlog complete flag */
94
- return pmt_crashlog_rc (entry , CRASHLOG_FLAG_TRIGGER_COMPLETE );
96
+ return pmt_crashlog_rc (crashlog , CRASHLOG_FLAG_TRIGGER_COMPLETE );
95
97
}
96
98
97
- static bool pmt_crashlog_disabled (struct intel_pmt_entry * entry )
99
+ static bool pmt_crashlog_disabled (struct crashlog_entry * crashlog )
98
100
{
99
101
/* return current value of the crashlog disabled flag */
100
- return pmt_crashlog_rc (entry , CRASHLOG_FLAG_DISABLE );
102
+ return pmt_crashlog_rc (crashlog , CRASHLOG_FLAG_DISABLE );
101
103
}
102
104
103
105
static bool pmt_crashlog_supported (struct intel_pmt_entry * entry )
@@ -115,20 +117,20 @@ static bool pmt_crashlog_supported(struct intel_pmt_entry *entry)
115
117
return crash_type == CRASH_TYPE_OOBMSM && version == 0 ;
116
118
}
117
119
118
- static void pmt_crashlog_set_disable (struct intel_pmt_entry * entry ,
120
+ static void pmt_crashlog_set_disable (struct crashlog_entry * crashlog ,
119
121
bool disable )
120
122
{
121
- pmt_crashlog_rmw (entry , CRASHLOG_FLAG_DISABLE , disable );
123
+ pmt_crashlog_rmw (crashlog , CRASHLOG_FLAG_DISABLE , disable );
122
124
}
123
125
124
- static void pmt_crashlog_set_clear (struct intel_pmt_entry * entry )
126
+ static void pmt_crashlog_set_clear (struct crashlog_entry * crashlog )
125
127
{
126
- pmt_crashlog_rmw (entry , CRASHLOG_FLAG_TRIGGER_CLEAR , true);
128
+ pmt_crashlog_rmw (crashlog , CRASHLOG_FLAG_TRIGGER_CLEAR , true);
127
129
}
128
130
129
- static void pmt_crashlog_set_execute (struct intel_pmt_entry * entry )
131
+ static void pmt_crashlog_set_execute (struct crashlog_entry * crashlog )
130
132
{
131
- pmt_crashlog_rmw (entry , CRASHLOG_FLAG_TRIGGER_EXECUTE , true);
133
+ pmt_crashlog_rmw (crashlog , CRASHLOG_FLAG_TRIGGER_EXECUTE , true);
132
134
}
133
135
134
136
/*
@@ -137,8 +139,8 @@ static void pmt_crashlog_set_execute(struct intel_pmt_entry *entry)
137
139
static ssize_t
138
140
enable_show (struct device * dev , struct device_attribute * attr , char * buf )
139
141
{
140
- struct intel_pmt_entry * entry = dev_get_drvdata (dev );
141
- bool enabled = !pmt_crashlog_disabled (entry );
142
+ struct crashlog_entry * crashlog = dev_get_drvdata (dev );
143
+ bool enabled = !pmt_crashlog_disabled (crashlog );
142
144
143
145
return sprintf (buf , "%d\n" , enabled );
144
146
}
@@ -147,19 +149,19 @@ static ssize_t
147
149
enable_store (struct device * dev , struct device_attribute * attr ,
148
150
const char * buf , size_t count )
149
151
{
150
- struct crashlog_entry * entry ;
152
+ struct crashlog_entry * crashlog ;
151
153
bool enabled ;
152
154
int result ;
153
155
154
- entry = dev_get_drvdata (dev );
156
+ crashlog = dev_get_drvdata (dev );
155
157
156
158
result = kstrtobool (buf , & enabled );
157
159
if (result )
158
160
return result ;
159
161
160
- guard (mutex )(& entry -> control_mutex );
162
+ guard (mutex )(& crashlog -> control_mutex );
161
163
162
- pmt_crashlog_set_disable (& entry -> entry , !enabled );
164
+ pmt_crashlog_set_disable (crashlog , !enabled );
163
165
164
166
return count ;
165
167
}
@@ -168,11 +170,11 @@ static DEVICE_ATTR_RW(enable);
168
170
static ssize_t
169
171
trigger_show (struct device * dev , struct device_attribute * attr , char * buf )
170
172
{
171
- struct intel_pmt_entry * entry ;
173
+ struct crashlog_entry * crashlog ;
172
174
bool trigger ;
173
175
174
- entry = dev_get_drvdata (dev );
175
- trigger = pmt_crashlog_complete (entry );
176
+ crashlog = dev_get_drvdata (dev );
177
+ trigger = pmt_crashlog_complete (crashlog );
176
178
177
179
return sprintf (buf , "%d\n" , trigger );
178
180
}
@@ -181,32 +183,32 @@ static ssize_t
181
183
trigger_store (struct device * dev , struct device_attribute * attr ,
182
184
const char * buf , size_t count )
183
185
{
184
- struct crashlog_entry * entry ;
186
+ struct crashlog_entry * crashlog ;
185
187
bool trigger ;
186
188
int result ;
187
189
188
- entry = dev_get_drvdata (dev );
190
+ crashlog = dev_get_drvdata (dev );
189
191
190
192
result = kstrtobool (buf , & trigger );
191
193
if (result )
192
194
return result ;
193
195
194
- guard (mutex )(& entry -> control_mutex );
196
+ guard (mutex )(& crashlog -> control_mutex );
195
197
196
198
/* if device is currently disabled, return busy */
197
- if (pmt_crashlog_disabled (& entry -> entry ))
199
+ if (pmt_crashlog_disabled (crashlog ))
198
200
return - EBUSY ;
199
201
200
202
if (!trigger ) {
201
- pmt_crashlog_set_clear (& entry -> entry );
203
+ pmt_crashlog_set_clear (crashlog );
202
204
return count ;
203
205
}
204
206
205
207
/* we cannot trigger a new crash if one is still pending */
206
- if (pmt_crashlog_complete (& entry -> entry ))
208
+ if (pmt_crashlog_complete (crashlog ))
207
209
return - EEXIST ;
208
210
209
- pmt_crashlog_set_execute (& entry -> entry );
211
+ pmt_crashlog_set_execute (crashlog );
210
212
211
213
return count ;
212
214
}
0 commit comments