Skip to contentSkip to conversation

mmc: mtk-sd: include bitfield header and fix incompatible pointer types

PATCH In review Wenbin Mei 3 participants 4 messages Jun 9, 2023

Subsystems (4)
lore
Share & tools
lore

Wenbin Mei

author
#0 lore raw

PATCH 1/1 mmc: mtk-sd: include bitfield header and fix incompatible pointer types

The following error appeared due to the patch:
364dae3e80a4 "mmc: mtk-sd: reduce CIT for better performance"

drivers/mmc/host/mtk-sd.c: In function 'msdc_cqe_cit_cal':
drivers/mmc/host/cqhci.h:27:41: error: implicit declaration of function 'FIELD_GET' [-Werror=implicit-function-declaration]

drivers/mmc/host/mtk-sd.c:2471:3: error: incompatible pointer types passing 'unsigned long *' to parameter of type 'uint64_t *' (aka 'unsigned long long *') [-Werror,-Wincompatible-pointer-types]

    2471 |                 do_div(hclk_freq, 1000);
         |                 ^~~~~~~~~~~~~~~~~~~~~~~
include/asm-generic/div64.h:238:22: note: expanded from macro 'do_div'
     238 |                 __rem = __div64_32(&(n), __base);       \
include/asm-generic/div64.h:213:38: note: passing argument to parameter 'dividend' here
     213 | extern uint32_t __div64_32(uint64_t *dividend, uint32_t divisor);

...

This patch corrects the issue.

Fixes 364dae3e80a4 ("mmc: mtk-sd: reduce CIT for better performance")
---
 drivers/mmc/host/cqhci.h  | 1 +
 drivers/mmc/host/mtk-sd.c | 5 ++---
 2 files changed, 3 insertions(+), 3 deletions(-)
drivers/mmc/host/cqhci.h +1 -0
index e35c655edefc..1a12e40a02e6 100644
@@ -5,6 +5,7 @@
 #define LINUX_MMC_CQHCI_H
 
 #include <linux/compiler.h>
+#include <linux/bitfield.h>
 #include <linux/bitops.h>
 #include <linux/spinlock_types.h>
 #include <linux/types.h>
drivers/mmc/host/mtk-sd.c +2 -3
index b582f19f82f2..99317fd9f084 100644
@@ -2456,15 +2456,14 @@ static void msdc_cqe_cit_cal(struct msdc_host *host, u64 timer_ns)
 	struct mmc_host *mmc = mmc_from_priv(host);
 	struct cqhci_host *cq_host = mmc->cqe_private;
 	u8 itcfmul;
-	unsigned long hclk_freq;
-	u64 value;
+	u64 hclk_freq, value;
 
 	/*
 	 * On MediaTek SoCs the MSDC controller's CQE uses msdc_hclk as ITCFVAL
 	 * so we multiply/divide the HCLK frequency by ITCFMUL to calculate the
 	 * Send Status Command Idle Timer (CIT) value.
 	 */
-	hclk_freq = clk_get_rate(host->h_clk);
+	hclk_freq = (u64)clk_get_rate(host->h_clk);
 	itcfmul = CQHCI_ITCFMUL(cqhci_readl(cq_host, CQHCI_CAP));
 	switch (itcfmul) {
 	case 0x0:
Signature · 1 line
2.25.1
maintainer Reviewed-by on v1 1/1
#1 lore raw

Il 09/06/23 09:48, Wenbin Mei ha scritto:

Quoted 13 lines

The following error appeared due to the patch:
364dae3e80a4 "mmc: mtk-sd: reduce CIT for better performance"

drivers/mmc/host/mtk-sd.c: In function 'msdc_cqe_cit_cal':
drivers/mmc/host/cqhci.h:27:41: error: implicit declaration of function 'FIELD_GET' [-Werror=implicit-function-declaration]

drivers/mmc/host/mtk-sd.c:2471:3: error: incompatible pointer types passing 'unsigned long *' to parameter of type 'uint64_t *' (aka 'unsigned long long *') [-Werror,-Wincompatible-pointer-types]

     2471 |                 do_div(hclk_freq, 1000);
          |                 ^~~~~~~~~~~~~~~~~~~~~~~
include/asm-generic/div64.h:238:22: note: expanded from macro 'do_div'
      238 |                 __rem = __div64_32(&(n), __base);       \
include/asm-generic/div64.h:213:38: note: passing argument to parameter 'dividend' here
      213 | extern uint32_t __div64_32(uint64_t *dividend, uint32_t divisor);
Quoted 7 lines

...

This patch corrects the issue.

Fixes 364dae3e80a4 ("mmc: mtk-sd: reduce CIT for better performance")

Fixes tags go before others... anyway:

Quoted 29 lines
---
  drivers/mmc/host/cqhci.h  | 1 +
  drivers/mmc/host/mtk-sd.c | 5 ++---
  2 files changed, 3 insertions(+), 3 deletions(-)
drivers/mmc/host/cqhci.h +1 -0
index e35c655edefc..1a12e40a02e6 100644
@@ -5,6 +5,7 @@
  #define LINUX_MMC_CQHCI_H
 
  #include <linux/compiler.h>
+#include <linux/bitfield.h>
  #include <linux/bitops.h>
  #include <linux/spinlock_types.h>
  #include <linux/types.h>
drivers/mmc/host/mtk-sd.c +1 -2
index b582f19f82f2..99317fd9f084 100644
@@ -2456,15 +2456,14 @@ static void msdc_cqe_cit_cal(struct msdc_host *host, u64 timer_ns)
  	struct mmc_host *mmc = mmc_from_priv(host);
  	struct cqhci_host *cq_host = mmc->cqe_private;
  	u8 itcfmul;
-	unsigned long hclk_freq;
-	u64 value;
+	u64 hclk_freq, value;
 

drivers/mmc/host/mtk-sd.c static void msdc_cqe_cit_cal(struct msdc_host *host, u64 timer_ns) · line 2469

Quoted 10 lines
drivers/mmc/host/mtk-sd.c +1 -1
  	/*
  	 * On MediaTek SoCs the MSDC controller's CQE uses msdc_hclk as ITCFVAL
  	 * so we multiply/divide the HCLK frequency by ITCFMUL to calculate the
  	 * Send Status Command Idle Timer (CIT) value.
  	 */
-	hclk_freq = clk_get_rate(host->h_clk);
+	hclk_freq = (u64)clk_get_rate(host->h_clk);
  	itcfmul = CQHCI_ITCFMUL(cqhci_readl(cq_host, CQHCI_CAP));
  	switch (itcfmul) {
  	case 0x0:

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

maintainer
#2 lore raw
In reply to Wenbin Mei
Quoted 13 lines · Wenbin Mei

The following error appeared due to the patch:
364dae3e80a4 "mmc: mtk-sd: reduce CIT for better performance"

drivers/mmc/host/mtk-sd.c: In function 'msdc_cqe_cit_cal':
drivers/mmc/host/cqhci.h:27:41: error: implicit declaration of function 'FIELD_GET' [-Werror=implicit-function-declaration]

drivers/mmc/host/mtk-sd.c:2471:3: error: incompatible pointer types passing 'unsigned long *' to parameter of type 'uint64_t *' (aka 'unsigned long long *') [-Werror,-Wincompatible-pointer-types]

    2471 |                 do_div(hclk_freq, 1000);
         |                 ^~~~~~~~~~~~~~~~~~~~~~~
include/asm-generic/div64.h:238:22: note: expanded from macro 'do_div'
     238 |                 __rem = __div64_32(&(n), __base);       \
include/asm-generic/div64.h:213:38: note: passing argument to parameter 'dividend' here
     213 | extern uint32_t __div64_32(uint64_t *dividend, uint32_t divisor);
Quoted 3 lines

...

This patch corrects the issue.

It doesn't look like Ulf has done a pull request for the original patch, so it might be better to submit a new version of that.

Quoted 33 lines
Fixes 364dae3e80a4 ("mmc: mtk-sd: reduce CIT for better performance")
---
 drivers/mmc/host/cqhci.h  | 1 +
 drivers/mmc/host/mtk-sd.c | 5 ++---
 2 files changed, 3 insertions(+), 3 deletions(-)
drivers/mmc/host/cqhci.h +1 -0
index e35c655edefc..1a12e40a02e6 100644
@@ -5,6 +5,7 @@
 #define LINUX_MMC_CQHCI_H
 
 #include <linux/compiler.h>
+#include <linux/bitfield.h>
 #include <linux/bitops.h>
 #include <linux/spinlock_types.h>
 #include <linux/types.h>
drivers/mmc/host/mtk-sd.c +1 -2
index b582f19f82f2..99317fd9f084 100644
@@ -2456,15 +2456,14 @@ static void msdc_cqe_cit_cal(struct msdc_host *host, u64 timer_ns)
 	struct mmc_host *mmc = mmc_from_priv(host);
 	struct cqhci_host *cq_host = mmc->cqe_private;
 	u8 itcfmul;
-	unsigned long hclk_freq;
-	u64 value;
+	u64 hclk_freq, value;
 

drivers/mmc/host/mtk-sd.c static void msdc_cqe_cit_cal(struct msdc_host *host, u64 timer_ns) · line 2469

Quoted 10 lines
drivers/mmc/host/mtk-sd.c +1 -1
 	/*
 	 * On MediaTek SoCs the MSDC controller's CQE uses msdc_hclk as ITCFVAL
 	 * so we multiply/divide the HCLK frequency by ITCFMUL to calculate the
 	 * Send Status Command Idle Timer (CIT) value.
 	 */
-	hclk_freq = clk_get_rate(host->h_clk);
+	hclk_freq = (u64)clk_get_rate(host->h_clk);
 	itcfmul = CQHCI_ITCFMUL(cqhci_readl(cq_host, CQHCI_CAP));
 	switch (itcfmul) {
 	case 0x0:

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

#3 lore raw
Quoted 22 lines · Adrian Hunter

External email : Please do not click links or open attachments until you have verified the sender or the content.

Quoted 5 lines · Wenbin Mei

The following error appeared due to the patch:
364dae3e80a4 "mmc: mtk-sd: reduce CIT for better performance"

drivers/mmc/host/mtk-sd.c: In function 'msdc_cqe_cit_cal':
drivers/mmc/host/cqhci.h:27:41: error: implicit declaration of

function 'FIELD_GET' [-Werror=implicit-function-declaration]

Quoted 2 lines

drivers/mmc/host/mtk-sd.c:2471:3: error: incompatible pointer types

passing 'unsigned long *' to parameter of type 'uint64_t *' (aka 'unsigned long long *') [-Werror,-Wincompatible-pointer-types]

Quoted 3 lines
    2471 |                 do_div(hclk_freq, 1000);
         |                 ^~~~~~~~~~~~~~~~~~~~~~~

include/asm-generic/div64.h:238:22: note: expanded from macro

'do_div'

Quoted 1 line
     238 |                 __rem = __div64_32(&(n),

__base); \

Quoted 1 line

include/asm-generic/div64.h:213:38: note: passing argument to

parameter 'dividend' here

Quoted 9 lines
Quoted 1 line
     213 | extern uint32_t __div64_32(uint64_t *dividend, uint32_t

divisor);

Quoted 3 lines

...

This patch corrects the issue.

It doesn't look like Ulf has done a pull request for the original patch, so it might be better to submit a new version of that.

If so, I will submit a new version of that.
And I wait for Ulf's reply, thanks

Begards,
Wenbin

Quoted 48 lines
Quoted 4 lines
Fixes 364dae3e80a4 ("mmc: mtk-sd: reduce CIT for better

performance")

drivers/mmc/host/mtk-sd.c static void msdc_cqe_cit_cal(struct

Quoted 22 lines
---
 drivers/mmc/host/cqhci.h  | 1 +
 drivers/mmc/host/mtk-sd.c | 5 ++---
 2 files changed, 3 insertions(+), 3 deletions(-)
drivers/mmc/host/cqhci.h +1 -0
index e35c655edefc..1a12e40a02e6 100644
@@ -5,6 +5,7 @@
 #define LINUX_MMC_CQHCI_H
 
 #include <linux/compiler.h>
+#include <linux/bitfield.h>
 #include <linux/bitops.h>
 #include <linux/spinlock_types.h>
 #include <linux/types.h>
drivers/mmc/host/mtk-sd.c +0 -0
index b582f19f82f2..99317fd9f084 100644
@@ -2456,15 +2456,14 @@ static void msdc_cqe_cit_cal(struct

msdc_host *host, u64 timer_ns)

drivers/mmc/host/mtk-sd.c static void msdc_cqe_cit_cal(struct msdc_host *host, u64 timer_ns)

Quoted 9 lines
drivers/mmc/host/mtk-sd.c +1 -2
 struct mmc_host *mmc = mmc_from_priv(host);
 struct cqhci_host *cq_host = mmc->cqe_private;
 u8 itcfmul;
-unsigned long hclk_freq;
-u64 value;
+u64 hclk_freq, value;
 
 /*
  * On MediaTek SoCs the MSDC controller's CQE uses msdc_hclk as

ITCFVAL

drivers/mmc/host/mtk-sd.c static void msdc_cqe_cit_cal(struct · line 2463

Quoted 1 line
drivers/mmc/host/mtk-sd.c +0 -0
  * so we multiply/divide the HCLK frequency by ITCFMUL to

calculate the

Quoted 7 lines
drivers/mmc/host/mtk-sd.c +1 -1
  * Send Status Command Idle Timer (CIT) value.
  */
-hclk_freq = clk_get_rate(host->h_clk);
+hclk_freq = (u64)clk_get_rate(host->h_clk);
 itcfmul = CQHCI_ITCFMUL(cqhci_readl(cq_host, CQHCI_CAP));
 switch (itcfmul) {
 case 0x0: