HID: sfh: fix address space confusion
Subsystems (2)
PATCH 1/1 HID: sfh: fix address space confusion
From: Arnd Bergmann <[email protected]>
The new driver uses a phys_addr_t to store a DMA address, which does not work when the two are different size:
drivers/hid/amd-sfh-hid/amd_sfh_client.c:157:11: error: incompatible pointer types passing 'phys_addr_t *' (aka 'unsigned int *') to parameter of type 'dma_addr_t *' (aka 'unsigned long long *') [-Werror,-Wincompatible-pointer-types]
&cl_data->sensor_phys_addr[i],
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~include/linux/dma-mapping.h:393:15: note: passing argument to parameter 'dma_handle' here
dma_addr_t *dma_handle, gfp_t gfp)
^
Change both the type and the variable name to dma_addr for consistency.
--- drivers/hid/amd-sfh-hid/amd_sfh_client.c | 8 ++++---- drivers/hid/amd-sfh-hid/amd_sfh_hid.h | 2 +- drivers/hid/amd-sfh-hid/amd_sfh_pcie.c | 2 +- drivers/hid/amd-sfh-hid/amd_sfh_pcie.h | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-)
drivers/hid/amd-sfh-hid/amd_sfh_client.c +4 -4
@@ -154,7 +154,7 @@ int amd_sfh_hid_client_init(struct amd_mp2_dev *privdata)for (i =0 ; i < cl_data->num_hid_devices; i++) { cl_data->sensor_virt_addr[i] =dma_alloc_coherent (dev,sizeof (int ) *8 , - &cl_data->sensor_phys_addr[i], + &cl_data->sensor_dma_addr[i],GFP_KERNEL ); cl_data->sensor_sts[i] =0 ; cl_data->sensor_requested_cnt[i] =0 ;
@@ -187,7 +187,7 @@ int amd_sfh_hid_client_init(struct amd_mp2_dev *privdata) } info.period =msecs_to_jiffies (AMD_SFH_IDLE_LOOP ); info.sensor_idx = cl_idx; - info.phys_address = cl_data->sensor_phys_addr[i]; + info.dma_address = cl_data->sensor_dma_addr[i]; cl_data->report_descr[i] =kzalloc (cl_data->report_descr_sz[i],GFP_KERNEL );if (!cl_data->report_descr[i]) {
@@ -212,7 +212,7 @@ int amd_sfh_hid_client_init(struct amd_mp2_dev *privdata)if (cl_data->sensor_virt_addr[i]) {dma_free_coherent (&privdata->pdev->dev,8 *sizeof (int ), cl_data->sensor_virt_addr[i], - cl_data->sensor_phys_addr[i]); + cl_data->sensor_dma_addr[i]); }kfree (cl_data->feature_report[i]);kfree (cl_data->input_report[i]);
@@ -238,7 +238,7 @@ int amd_sfh_hid_client_deinit(struct amd_mp2_dev *privdata)if (cl_data->sensor_virt_addr[i]) {dma_free_coherent (&privdata->pdev->dev,8 *sizeof (int ), cl_data->sensor_virt_addr[i], - cl_data->sensor_phys_addr[i]); + cl_data->sensor_dma_addr[i]); } }kfree (cl_data);
drivers/hid/amd-sfh-hid/amd_sfh_hid.h +1 -1
@@ -27,7 +27,7 @@ struct amdtp_cl_data {int hid_descr_size[MAX_HID_DEVICES ];phys_addr_t phys_addr_base;u32 *sensor_virt_addr[MAX_HID_DEVICES ]; -phys_addr_t sensor_phys_addr[MAX_HID_DEVICES ]; +dma_addr_t sensor_dma_addr[MAX_HID_DEVICES ];u32 sensor_sts[MAX_HID_DEVICES ];u32 sensor_requested_cnt[MAX_HID_DEVICES ];u8 report_type[MAX_HID_DEVICES ];
drivers/hid/amd-sfh-hid/amd_sfh_pcie.c +1 -1
@@ -41,7 +41,7 @@ void amd_start_sensor(struct amd_mp2_dev *privdata, struct amd_mp2_sensor_info i cmd_param.s.buf_layout =1 ; cmd_param.s.buf_length =16 ; -writeq (info.phys_address, privdata->mmio +AMD_C2P_MSG2 ); +writeq (info.dma_address, privdata->mmio +AMD_C2P_MSG2 );writel (cmd_param.ul, privdata->mmio +AMD_C2P_MSG1 );writel (cmd_base.ul, privdata->mmio +AMD_C2P_MSG0 ); }
drivers/hid/amd-sfh-hid/amd_sfh_pcie.h +1 -1
@@ -67,7 +67,7 @@ struct amd_mp2_dev {struct amd_mp2_sensor_info {u8 sensor_idx;u32 period; -phys_addr_t phys_address; +dma_addr_t dma_address; };void amd_start_sensor (struct amd_mp2_dev *privdata,struct amd_mp2_sensor_info info);
Signature · 1 line
2.29.2
Jiri Kosina
maintainerQuoted 8 lines · Arnd Bergmann
From: Arnd Bergmann <[email protected]>
The new driver uses a
phys_addr_tto store a DMA address, which does not work when the two are different size:
drivers/hid/amd-sfh-hid/amd_sfh_client.c:157:11: error: incompatible pointer types passing 'phys_addr_t*' (aka 'unsigned int *') to parameter of type 'dma_addr_t*' (aka 'unsigned long long *') [-Werror,-Wincompatible-pointer-types]&cl_data->sensor_phys_addr[i], ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Quoted 8 lines
include/linux/dma-mapping.h:393:15: note: passing argument to parameter 'dma_handle' here
dma_addr_t*dma_handle,gfp_tgfp)
^Change both the type and the variable name to
dma_addrfor consistency.Fixes 4b2c53d93a4b ("SFH:Transport Driver to add support of AMD Sensor Fusion Hub (SFH)")Signed-off-by Arnd Bergmann <[email protected]>
Good catch; queued for 5.11, thanks.
Signature · 2 lines
Jiri Kosina SUSE Labs