@@ -149,20 +149,20 @@ static int qt1070_probe(struct i2c_client *client)
149
149
if (!qt1070_identify (client ))
150
150
return - ENODEV ;
151
151
152
- data = kzalloc (sizeof (struct qt1070_data ), GFP_KERNEL );
153
- input = input_allocate_device ();
154
- if (!data || !input ) {
155
- dev_err (& client -> dev , "insufficient memory\n" );
156
- err = - ENOMEM ;
157
- goto err_free_mem ;
158
- }
152
+ data = devm_kzalloc (& client -> dev , sizeof (struct qt1070_data ),
153
+ GFP_KERNEL );
154
+ if (!data )
155
+ return - ENOMEM ;
156
+
157
+ input = devm_input_allocate_device (& client -> dev );
158
+ if (!input )
159
+ return - ENOMEM ;
159
160
160
161
data -> client = client ;
161
162
data -> input = input ;
162
163
data -> irq = client -> irq ;
163
164
164
165
input -> name = "AT42QT1070 QTouch Sensor" ;
165
- input -> dev .parent = & client -> dev ;
166
166
input -> id .bustype = BUS_I2C ;
167
167
168
168
/* Add the keycode */
@@ -185,19 +185,20 @@ static int qt1070_probe(struct i2c_client *client)
185
185
qt1070_write (client , RESET , 1 );
186
186
msleep (QT1070_RESET_TIME );
187
187
188
- err = request_threaded_irq (client -> irq , NULL , qt1070_interrupt ,
189
- IRQF_TRIGGER_NONE | IRQF_ONESHOT ,
190
- client -> dev .driver -> name , data );
188
+ err = devm_request_threaded_irq (& client -> dev , client -> irq ,
189
+ NULL , qt1070_interrupt ,
190
+ IRQF_TRIGGER_NONE | IRQF_ONESHOT ,
191
+ client -> dev .driver -> name , data );
191
192
if (err ) {
192
193
dev_err (& client -> dev , "fail to request irq\n" );
193
- goto err_free_mem ;
194
+ return err ;
194
195
}
195
196
196
197
/* Register the input device */
197
198
err = input_register_device (data -> input );
198
199
if (err ) {
199
200
dev_err (& client -> dev , "Failed to register input device\n" );
200
- goto err_free_irq ;
201
+ return err ;
201
202
}
202
203
203
204
i2c_set_clientdata (client , data );
@@ -206,24 +207,6 @@ static int qt1070_probe(struct i2c_client *client)
206
207
qt1070_read (client , DET_STATUS );
207
208
208
209
return 0 ;
209
-
210
- err_free_irq :
211
- free_irq (client -> irq , data );
212
- err_free_mem :
213
- input_free_device (input );
214
- kfree (data );
215
- return err ;
216
- }
217
-
218
- static void qt1070_remove (struct i2c_client * client )
219
- {
220
- struct qt1070_data * data = i2c_get_clientdata (client );
221
-
222
- /* Release IRQ */
223
- free_irq (client -> irq , data );
224
-
225
- input_unregister_device (data -> input );
226
- kfree (data );
227
210
}
228
211
229
212
static int qt1070_suspend (struct device * dev )
@@ -272,7 +255,6 @@ static struct i2c_driver qt1070_driver = {
272
255
},
273
256
.id_table = qt1070_id ,
274
257
.probe = qt1070_probe ,
275
- .remove = qt1070_remove ,
276
258
};
277
259
278
260
module_i2c_driver (qt1070_driver );
0 commit comments