diff options
author | Jeffrey Lin <jeffrey.lin@rad-ic.com> | 2018-01-05 06:35:23 +0100 |
---|---|---|
committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2018-01-05 18:28:39 +0100 |
commit | 92a37438ced77a8acb380457e0a28970f1ae9472 (patch) | |
tree | e6c265f80bc448c43146c04c5829fc95d2b2dd72 /drivers/input | |
parent | Input: tps65218-pwrbutton - fix a spelling mistake in Kconfig (diff) | |
download | linux-92a37438ced77a8acb380457e0a28970f1ae9472.tar.xz linux-92a37438ced77a8acb380457e0a28970f1ae9472.zip |
Input: raydium_i2c_ts - include hardware version in firmware name
Add hardware version to the firmware file name to handle scenarios where
single system image supports variety of devices.
Signed-off-by: Jeffrey Lin <jeffrey.lin@rad-ic.com>
Patchwork-Id: 10127677
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Diffstat (limited to 'drivers/input')
-rw-r--r-- | drivers/input/touchscreen/raydium_i2c_ts.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/drivers/input/touchscreen/raydium_i2c_ts.c b/drivers/input/touchscreen/raydium_i2c_ts.c index 100538d64fff..d1c09e6a2cb6 100644 --- a/drivers/input/touchscreen/raydium_i2c_ts.c +++ b/drivers/input/touchscreen/raydium_i2c_ts.c @@ -752,13 +752,20 @@ static int raydium_i2c_fw_update(struct raydium_data *ts) { struct i2c_client *client = ts->client; const struct firmware *fw = NULL; - const char *fw_file = "raydium.fw"; + char *fw_file; int error; + fw_file = kasprintf(GFP_KERNEL, "raydium_%#04x.fw", + le32_to_cpu(ts->info.hw_ver)); + if (!fw_file) + return -ENOMEM; + + dev_dbg(&client->dev, "firmware name: %s\n", fw_file); + error = request_firmware(&fw, fw_file, &client->dev); if (error) { dev_err(&client->dev, "Unable to open firmware %s\n", fw_file); - return error; + goto out_free_fw_file; } disable_irq(client->irq); @@ -787,6 +794,9 @@ out_enable_irq: release_firmware(fw); +out_free_fw_file: + kfree(fw_file); + return error; } |