aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/misc/amd-sbi/rmi-i2c.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/misc/amd-sbi/rmi-i2c.c')
-rw-r--r--drivers/misc/amd-sbi/rmi-i2c.c25
1 files changed, 21 insertions, 4 deletions
diff --git a/drivers/misc/amd-sbi/rmi-i2c.c b/drivers/misc/amd-sbi/rmi-i2c.c
index 7a9801273a4c..f891f5af4bc6 100644
--- a/drivers/misc/amd-sbi/rmi-i2c.c
+++ b/drivers/misc/amd-sbi/rmi-i2c.c
@@ -38,15 +38,14 @@ static int sbrmi_enable_alert(struct sbrmi_data *data)
static int sbrmi_get_max_pwr_limit(struct sbrmi_data *data)
{
- struct sbrmi_mailbox_msg msg = { 0 };
+ struct apml_mbox_msg msg = { 0 };
int ret;
msg.cmd = SBRMI_READ_PKG_MAX_PWR_LIMIT;
- msg.read = true;
ret = rmi_mailbox_xfer(data, &msg);
if (ret < 0)
return ret;
- data->pwr_limit_max = msg.data_out;
+ data->pwr_limit_max = msg.mb_in_out;
return ret;
}
@@ -81,8 +80,25 @@ static int sbrmi_i2c_probe(struct i2c_client *client)
if (ret < 0)
return ret;
+ data->dev_static_addr = client->addr;
dev_set_drvdata(dev, data);
- return create_hwmon_sensor_device(dev, data);
+
+ ret = create_hwmon_sensor_device(dev, data);
+ if (ret < 0)
+ return ret;
+ return create_misc_rmi_device(data, dev);
+}
+
+static void sbrmi_i2c_remove(struct i2c_client *client)
+{
+ struct sbrmi_data *data = dev_get_drvdata(&client->dev);
+
+ misc_deregister(&data->sbrmi_misc_dev);
+ /* Assign fops and parent of misc dev to NULL */
+ data->sbrmi_misc_dev.fops = NULL;
+ data->sbrmi_misc_dev.parent = NULL;
+ dev_info(&client->dev, "Removed sbrmi-i2c driver\n");
+ return;
}
static const struct i2c_device_id sbrmi_id[] = {
@@ -105,6 +121,7 @@ static struct i2c_driver sbrmi_driver = {
.of_match_table = of_match_ptr(sbrmi_of_match),
},
.probe = sbrmi_i2c_probe,
+ .remove = sbrmi_i2c_remove,
.id_table = sbrmi_id,
};