Skip to contentSkip to conversation

platform/x86: Non Sequential Device mode handling

PATCH In review Shravan S 2 participants 2 messages Oct 6, 2021 – Oct 11, 2021

Subsystems (2)
lore
Share & tools
lore

Shravan S

author maintainer
#0 lore raw

PATCH v2 1/1 platform/x86: Non Sequential Device mode handling

SAR information from BIOS may come in non sequential pattern

To overcome the issue, a check is made to extract the right SAR information using the device mode which is currently being used.

Remove .owner field if calls are used which set it automatically Generated by: scripts/coccinelle/api/platform_no_drv_owner.cocci

---
V2 :
* Remove .owner field as it is set automatically by scripts
* Check Device modes as packages may not come sequentially from BIOS

---
 MAINTAINERS                                   |  2 +-
 .../platform/x86/intel/int1092/intel_sar.c    | 23 ++++++++++++-------
 2 files changed, 16 insertions(+), 9 deletions(-)
MAINTAINERS +1 -1
index eeb4c70b3d5b..6cfad2bf9d81 100644
@@ -9302,7 +9302,7 @@ S:	Maintained
 F:	drivers/platform/x86/intel/atomisp2/led.c
 
 INTEL BIOS SAR INT1092 DRIVER
-M:	Shravan S <[email protected]>
+M:	Shravan Sudhakar <[email protected]>
 M:	Intel Corporation <[email protected]>
 L:	[email protected]
 S:	Maintained
drivers/platform/x86/intel/int1092/intel_sar.c +15 -8
index 379560fe5df9..e03943e6380a 100644
@@ -42,12 +42,20 @@ static void update_sar_data(struct wwan_sar_context *context)
 
 	if (config->device_mode_info &&
 	    context->sar_data.device_mode < config->total_dev_mode) {
-		struct wwan_device_mode_info *dev_mode =
-			&config->device_mode_info[context->sar_data.device_mode];
-
-		context->sar_data.antennatable_index = dev_mode->antennatable_index;
-		context->sar_data.bandtable_index = dev_mode->bandtable_index;
-		context->sar_data.sartable_index = dev_mode->sartable_index;
+		int itr = 0;
+
+		for (itr = 0; itr < config->total_dev_mode; itr++) {
+			if (context->sar_data.device_mode ==
+				config->device_mode_info[itr].device_mode) {
+				struct wwan_device_mode_info *dev_mode =
+				&config->device_mode_info[itr];
+
+				context->sar_data.antennatable_index = dev_mode->antennatable_index;
+				context->sar_data.bandtable_index = dev_mode->bandtable_index;
+				context->sar_data.sartable_index = dev_mode->sartable_index;
+				break;
+			}
+		}
 	}
 }
 
@@ -305,7 +313,6 @@ static struct platform_driver sar_driver = {
 	.remove = sar_remove,
 	.driver = {
 		.name = DRVNAME,
-		.owner = THIS_MODULE,
 		.acpi_match_table = ACPI_PTR(sar_device_ids)
 	}
 };
@@ -313,4 +320,4 @@ module_platform_driver(sar_driver);
 
 MODULE_LICENSE("GPL v2");
 MODULE_DESCRIPTION("Platform device driver for INTEL MODEM BIOS SAR");
-MODULE_AUTHOR("Shravan S <[email protected]>");
+MODULE_AUTHOR("Shravan Sudhakar <[email protected]>");

base-commit: 6880fa6c56601bb8ed59df6c30fd390cc5f6dd8f

Signature · 1 line
2.17.1
#1 lore raw

Hi,

Quoted 5 lines · Shravan S

SAR information from BIOS may come in non sequential pattern

To overcome the issue, a check is made to extract the right SAR information using the device mode which is currently being used.

Quoted 8 lines

Remove .owner field if calls are used which set it automatically Generated by: scripts/coccinelle/api/platform_no_drv_owner.cocci

---
V2 :
* Remove .owner field as it is set automatically by scripts
* Check Device modes as packages may not come sequentially from BIOS

Next time please split a patch like this into 3 patches:

1. s/Shravan S/Shravan Sudhakar/
2. Remove .owner field
3. Fix Non Sequential Device mode handling

I've merged this as now, so that the fix can be included in my next pdx86 fixes pull-req for 5.15 :

Thank you for your patch, I've applied this patch to my review-hans branch:
https://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86.git/log/?h=review-hans

Note it will show up in my review-hans branch once I've pushed my local branch there, which might take a while.

Once I've run some tests on this branch the patches there will be added to the platform-drivers-x86/for-next branch and eventually will be included in the pdx86 pull-request to Linus for the next merge-window.

Regards,

Hans

Quoted 67 lines
---
 MAINTAINERS                                   |  2 +-
 .../platform/x86/intel/int1092/intel_sar.c    | 23 ++++++++++++-------
 2 files changed, 16 insertions(+), 9 deletions(-)
MAINTAINERS +1 -1
index eeb4c70b3d5b..6cfad2bf9d81 100644
@@ -9302,7 +9302,7 @@ S:	Maintained
 F:	drivers/platform/x86/intel/atomisp2/led.c
 
 INTEL BIOS SAR INT1092 DRIVER
-M:	Shravan S <[email protected]>
+M:	Shravan Sudhakar <[email protected]>
 M:	Intel Corporation <[email protected]>
 L:	[email protected]
 S:	Maintained
drivers/platform/x86/intel/int1092/intel_sar.c +15 -8
index 379560fe5df9..e03943e6380a 100644
@@ -42,12 +42,20 @@ static void update_sar_data(struct wwan_sar_context *context)
 
 	if (config->device_mode_info &&
 	    context->sar_data.device_mode < config->total_dev_mode) {
-		struct wwan_device_mode_info *dev_mode =
-			&config->device_mode_info[context->sar_data.device_mode];
-
-		context->sar_data.antennatable_index = dev_mode->antennatable_index;
-		context->sar_data.bandtable_index = dev_mode->bandtable_index;
-		context->sar_data.sartable_index = dev_mode->sartable_index;
+		int itr = 0;
+
+		for (itr = 0; itr < config->total_dev_mode; itr++) {
+			if (context->sar_data.device_mode ==
+				config->device_mode_info[itr].device_mode) {
+				struct wwan_device_mode_info *dev_mode =
+				&config->device_mode_info[itr];
+
+				context->sar_data.antennatable_index = dev_mode->antennatable_index;
+				context->sar_data.bandtable_index = dev_mode->bandtable_index;
+				context->sar_data.sartable_index = dev_mode->sartable_index;
+				break;
+			}
+		}
 	}
 }
 
@@ -305,7 +313,6 @@ static struct platform_driver sar_driver = {
 	.remove = sar_remove,
 	.driver = {
 		.name = DRVNAME,
-		.owner = THIS_MODULE,
 		.acpi_match_table = ACPI_PTR(sar_device_ids)
 	}
 };
@@ -313,4 +320,4 @@ module_platform_driver(sar_driver);
 
 MODULE_LICENSE("GPL v2");
 MODULE_DESCRIPTION("Platform device driver for INTEL MODEM BIOS SAR");
-MODULE_AUTHOR("Shravan S <[email protected]>");
+MODULE_AUTHOR("Shravan Sudhakar <[email protected]>");

base-commit: 6880fa6c56601bb8ed59df6c30fd390cc5f6dd8f