From fd106d73c0d8e8bc2ee9b5905055b7d3bfcaf30f Mon Sep 17 00:00:00 2001 From: yanyh2 Date: Thu, 12 Sep 2019 18:51:40 +0800 Subject: [PATCH] add calibration_data node to laser sysfs Add calibration_data node to laser sysfs: /sys/devices/virtual/laser/stmvl53l1/calibration_data Change-Id: I13b71671c81b3e0b9f0031e64866680f26161a12 Signed-off-by: yanyh2 Reviewed-on: https://gerrit.mot.com/1420664 SLTApproved: Slta Waiver SME-Granted: SME Approvals Granted Tested-by: Jira Key Reviewed-by: Jianqi Yang Submit-Approved: Jira Key --- drivers/input/misc/vl53L1/stmvl53l1_module.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/input/misc/vl53L1/stmvl53l1_module.c b/drivers/input/misc/vl53L1/stmvl53l1_module.c index 1280328ce97d..a3a12ba35307 100644 --- a/drivers/input/misc/vl53L1/stmvl53l1_module.c +++ b/drivers/input/misc/vl53L1/stmvl53l1_module.c @@ -4768,10 +4768,20 @@ int stmvl53l1_sysfs_laser(struct stmvl53l1_data *data, bool create) &laser_name_attributes); if (error) goto device_destroy; + + error = sysfs_create_bin_file(&laser_class_dev->kobj, + &stmvl53l1_calib_data_attr); + if (error) { + device_remove_file(laser_class_dev, + &laser_name_attributes); + goto device_destroy; + } } else { if (!laser_class || !laser_class_dev) return -ENODEV; + sysfs_remove_bin_file(&laser_class_dev->kobj, + &stmvl53l1_calib_data_attr); device_remove_file(laser_class_dev, &laser_name_attributes); for (i = 0; stmvl53l1_attributes[i] != NULL; ++i)