[PATCH v2 00/10] staging: mt7621-mmc: Fixes and cleanups

2018-04-07 Thread Christian Lütke-Stetzkamp
Again, here are some fixes (most of them reported by Dan Carpenter)
and some removements of unused code in the mt7621-mmc driver. With
this patches, the driver at least compiles while CONFIG_PM is
selected, but it remains untested.

Changes in v2:
* Removed assignment and return value in msdc_debug_proc_init;
* Added Reviewed-by tags.

Christian Lütke-Stetzkamp (10):
  staging: mt7621-mmc: Fix power management by removing old api
  staging: mt7621-mmc: Remove constant flag
  staging: mt7621-mmc: Remove unused global: msdc_6575_host
  staging: mt7621-mmc: Remove unused functions
  staging: mt7621-mmc: Remove constant flag MSDC_HIGHSPEED
  staging: mt7621-mmc: Fix dereference before check in msdc_drv_pm
  staging: mt7621-mmc: Remove error message in debug
  staging: mt7621-mmc: Fix debug file world writable
  staging: mt7621-mmc: Fix: copy_from_user() returns a positive value
  staging: mt7621-mmc: Remove redundant opcode check

 drivers/staging/mt7621-mmc/board.h |  2 --
 drivers/staging/mt7621-mmc/dbg.c   | 14 +++--
 drivers/staging/mt7621-mmc/dbg.h   |  2 +-
 drivers/staging/mt7621-mmc/sd.c| 60 +-
 4 files changed, 12 insertions(+), 66 deletions(-)

-- 
2.16.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v2 01/10] staging: mt7621-mmc: Fix power management by removing old api

2018-04-07 Thread Christian Lütke-Stetzkamp
The mmc_suspend|resume_host functions have been decrepated in the
3.11 [1] release and were completely removed in 3.13 [2]. Removing the
calls to this functions as it was done for other mmc host drivers
before the old api was removed (eg. [3]) fixes compile errors in this
driver while CONFIG_PM is enabled.

The rest of the removed code is simply dead, the MSDC_SYS_SUSPEND flag
is always set and will be removed in a later patch.

[1] commit 986892ca78ee ("mmc: core: Initiate suspend|resume from mmc bus 
instead of mmc host")
[2] commit 3c0d22e8180b ("mmc: core: Remove deprecated mmc_suspend|resume_host 
APIs")
[3] commit 1e63d4854202 ("mmc: au1xmmc: Move away from using deprecated APIs")

Signed-off-by: Christian Lütke-Stetzkamp 
Reviewed-by: NeilBrown 
---
 drivers/staging/mt7621-mmc/sd.c | 14 --
 1 file changed, 14 deletions(-)

diff --git a/drivers/staging/mt7621-mmc/sd.c b/drivers/staging/mt7621-mmc/sd.c
index 24fdeb9e6173..63ec0e7360bc 100644
--- a/drivers/staging/mt7621-mmc/sd.c
+++ b/drivers/staging/mt7621-mmc/sd.c
@@ -858,13 +858,6 @@ static void msdc_pm(pm_message_t state, void *data)
host->suspend = 1;
host->pm_state = state;  /* default PMSG_RESUME */
 
-   INIT_MSG("%s Suspend", evt == PM_EVENT_SUSPEND ? "PM" : "USR");
-   if (host->hw->flags & MSDC_SYS_SUSPEND) /* set for card */ {
-   (void)mmc_suspend_host(host->mmc);
-   } else {
-   // host->mmc->pm_flags |= MMC_PM_IGNORE_PM_NOTIFY;  /* 
just for double confirm */ /* --- by chhung */
-   mmc_remove_host(host->mmc);
-   }
} else if (evt == PM_EVENT_RESUME || evt == PM_EVENT_USER_RESUME) {
if (!host->suspend) {
//ERR_MSG("warning: already resume");
@@ -880,13 +873,6 @@ static void msdc_pm(pm_message_t state, void *data)
host->suspend = 0;
host->pm_state = state;
 
-   INIT_MSG("%s Resume", evt == PM_EVENT_RESUME ? "PM" : "USR");
-   if (host->hw->flags & MSDC_SYS_SUSPEND) { /* will not set for 
WIFI */
-   (void)mmc_resume_host(host->mmc);
-   } else {
-   // host->mmc->pm_flags |= MMC_PM_IGNORE_PM_NOTIFY; /* 
--- by chhung */
-   mmc_add_host(host->mmc);
-   }
}
 }
 #endif
-- 
2.16.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v2 05/10] staging: mt7621-mmc: Remove constant flag MSDC_HIGHSPEED

2018-04-07 Thread Christian Lütke-Stetzkamp
The MSDC_HIGHSPEED flag is always set and never unset, remove it to
clean up the code.

Signed-off-by: Christian Lütke-Stetzkamp 
Reviewed-by: NeilBrown 
---
 drivers/staging/mt7621-mmc/board.h | 1 -
 drivers/staging/mt7621-mmc/sd.c| 7 ++-
 2 files changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/mt7621-mmc/board.h 
b/drivers/staging/mt7621-mmc/board.h
index ca07608b8f44..312cd5116c37 100644
--- a/drivers/staging/mt7621-mmc/board.h
+++ b/drivers/staging/mt7621-mmc/board.h
@@ -52,7 +52,6 @@ typedef void (*pm_callback_t)(pm_message_t state, void *data);
 #define MSDC_SDIO_IRQ   (1 << 3)  /* use internal sdio irq (bus)   */
 #define MSDC_EXT_SDIO_IRQ   (1 << 4)  /* use external sdio irq */
 #define MSDC_REMOVABLE  (1 << 5)  /* removable slot*/
-#define MSDC_HIGHSPEED  (1 << 7)  /* high-speed mode support   */
 #define MSDC_UHS1   (1 << 8)  /* uhs-1 mode support*/
 #define MSDC_DDR(1 << 9)  /* ddr mode support  */
 
diff --git a/drivers/staging/mt7621-mmc/sd.c b/drivers/staging/mt7621-mmc/sd.c
index 4e98c61c145f..ae0807b8c98f 100644
--- a/drivers/staging/mt7621-mmc/sd.c
+++ b/drivers/staging/mt7621-mmc/sd.c
@@ -183,7 +183,7 @@ struct msdc_hw msdc0_hw = {
.cmd_drv= 4,
.dat_drv= 4,
.data_offset= 0,
-   .flags  = MSDC_CD_PIN_EN | MSDC_REMOVABLE | MSDC_HIGHSPEED,
+   .flags  = MSDC_CD_PIN_EN | MSDC_REMOVABLE,
 // .flags  = MSDC_WP_PIN_EN | MSDC_CD_PIN_EN | MSDC_REMOVABLE,
 };
 
@@ -2675,10 +2675,7 @@ static int msdc_drv_probe(struct platform_device *pdev)
mmc->f_max  = HOST_MAX_MCLK;
mmc->ocr_avail  = MSDC_OCR_AVAIL;
 
-   /* For sd card: MSDC_WP_PIN_EN | MSDC_CD_PIN_EN | MSDC_REMOVABLE | 
MSDC_HIGHSPEED,
-  For sdio   : MSDC_EXT_SDIO_IRQ | MSDC_HIGHSPEED */
-   if (hw->flags & MSDC_HIGHSPEED)
-   mmc->caps   = MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED;
+   mmc->caps   = MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED;
 
//TODO: read this as bus-width from dt (via mmc_of_parse)
mmc->caps  |= MMC_CAP_4_BIT_DATA;
-- 
2.16.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v2 03/10] staging: mt7621-mmc: Remove unused global: msdc_6575_host

2018-04-07 Thread Christian Lütke-Stetzkamp
The mt6575_host variable is never used, only set and
exported. Removing it for code cleanup.

Signed-off-by: Christian Lütke-Stetzkamp 
Reviewed-by: NeilBrown 
---
 drivers/staging/mt7621-mmc/sd.c | 5 -
 1 file changed, 5 deletions(-)

diff --git a/drivers/staging/mt7621-mmc/sd.c b/drivers/staging/mt7621-mmc/sd.c
index a2e7341372be..73c1861ac539 100644
--- a/drivers/staging/mt7621-mmc/sd.c
+++ b/drivers/staging/mt7621-mmc/sd.c
@@ -154,7 +154,6 @@ static int cd_active_low = 1;
 //#define PERI_MSDC2_PDN(17)
 //#define PERI_MSDC3_PDN(18)
 
-struct msdc_host *msdc_6575_host[] = {NULL, NULL, NULL, NULL};
 #if 0 /* --- by chhung */
 /* gate means clock power down */
 static int g_clk_gate = 0;
@@ -2771,8 +2770,6 @@ static int msdc_drv_probe(struct platform_device *pdev)
goto release_mem;
}
msdc_init_gpd_bd(host, >dma);
-   /*for emmc*/
-   msdc_6575_host[pdev->id] = host;
 
 #if 0
tasklet_init(>card_tasklet, msdc_tasklet_card, (ulong)host);
@@ -2949,5 +2946,3 @@ module_exit(mt_msdc_exit);
 MODULE_LICENSE("GPL");
 MODULE_DESCRIPTION("MediaTek MT6575 SD/MMC Card Driver");
 MODULE_AUTHOR("Infinity Chen ");
-
-EXPORT_SYMBOL(msdc_6575_host);
-- 
2.16.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v2 10/10] staging: mt7621-mmc: Remove redundant opcode check

2018-04-07 Thread Christian Lütke-Stetzkamp
The opcode check in msdc_command_start is redundant in case of
MMC_SET_RELATIVE_ADDR, this is 3 like SD_SEND_RELATIVE_ADDR, so the
second check can be removed.

Reported-by: Dan Carpenter 
Signed-off-by: Christian Lütke-Stetzkamp 
Reviewed-by: NeilBrown 
---
 drivers/staging/mt7621-mmc/sd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/mt7621-mmc/sd.c b/drivers/staging/mt7621-mmc/sd.c
index 799ec20f9820..eac14e5aa805 100644
--- a/drivers/staging/mt7621-mmc/sd.c
+++ b/drivers/staging/mt7621-mmc/sd.c
@@ -875,7 +875,7 @@ static unsigned int msdc_command_start(struct msdc_host   
*host,
 */
if (opcode == MMC_SEND_OP_COND || opcode == SD_APP_OP_COND) {
resp = RESP_R3;
-   } else if (opcode == MMC_SET_RELATIVE_ADDR || opcode == 
SD_SEND_RELATIVE_ADDR) {
+   } else if (opcode == MMC_SET_RELATIVE_ADDR) {
resp = (mmc_cmd_type(cmd) == MMC_CMD_BCR) ? RESP_R6 : RESP_R1;
} else if (opcode == MMC_FAST_IO) {
resp = RESP_R4;
-- 
2.16.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v2 06/10] staging: mt7621-mmc: Fix dereference before check in msdc_drv_pm

2018-04-07 Thread Christian Lütke-Stetzkamp
In the msdc_drv_pm function the variable mmc is dereferenced before
checked. Reordering fixes that.

Reported-by: Dan Carpenter 
Signed-off-by: Christian Lütke-Stetzkamp 
Reviewed-by: NeilBrown 
---
 drivers/staging/mt7621-mmc/sd.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/mt7621-mmc/sd.c b/drivers/staging/mt7621-mmc/sd.c
index ae0807b8c98f..799ec20f9820 100644
--- a/drivers/staging/mt7621-mmc/sd.c
+++ b/drivers/staging/mt7621-mmc/sd.c
@@ -2842,10 +2842,10 @@ static int msdc_drv_remove(struct platform_device *pdev)
 static void msdc_drv_pm(struct platform_device *pdev, pm_message_t state)
 {
struct mmc_host *mmc = platform_get_drvdata(pdev);
-   struct msdc_host *host = mmc_priv(mmc);
-
-   if (mmc)
+   if (mmc) {
+   struct msdc_host *host = mmc_priv(mmc);
msdc_pm(state, (void *)host);
+   }
 }
 
 static int msdc_drv_suspend(struct platform_device *pdev, pm_message_t state)
-- 
2.16.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v2 02/10] staging: mt7621-mmc: Remove constant flag

2018-04-07 Thread Christian Lütke-Stetzkamp
The MSDC_SYS_SUSPEND flag is always set and is never unset. Removing
it cleans up the code.

Signed-off-by: Christian Lütke-Stetzkamp 
Reviewed-by: NeilBrown 
---
 drivers/staging/mt7621-mmc/board.h | 1 -
 drivers/staging/mt7621-mmc/sd.c| 8 
 2 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/mt7621-mmc/board.h 
b/drivers/staging/mt7621-mmc/board.h
index aa62a7243c80..ca07608b8f44 100644
--- a/drivers/staging/mt7621-mmc/board.h
+++ b/drivers/staging/mt7621-mmc/board.h
@@ -52,7 +52,6 @@ typedef void (*pm_callback_t)(pm_message_t state, void *data);
 #define MSDC_SDIO_IRQ   (1 << 3)  /* use internal sdio irq (bus)   */
 #define MSDC_EXT_SDIO_IRQ   (1 << 4)  /* use external sdio irq */
 #define MSDC_REMOVABLE  (1 << 5)  /* removable slot*/
-#define MSDC_SYS_SUSPEND(1 << 6)  /* suspended by system   */
 #define MSDC_HIGHSPEED  (1 << 7)  /* high-speed mode support   */
 #define MSDC_UHS1   (1 << 8)  /* uhs-1 mode support*/
 #define MSDC_DDR(1 << 9)  /* ddr mode support  */
diff --git a/drivers/staging/mt7621-mmc/sd.c b/drivers/staging/mt7621-mmc/sd.c
index 63ec0e7360bc..a2e7341372be 100644
--- a/drivers/staging/mt7621-mmc/sd.c
+++ b/drivers/staging/mt7621-mmc/sd.c
@@ -184,8 +184,8 @@ struct msdc_hw msdc0_hw = {
.cmd_drv= 4,
.dat_drv= 4,
.data_offset= 0,
-   .flags  = MSDC_SYS_SUSPEND | MSDC_CD_PIN_EN | MSDC_REMOVABLE | 
MSDC_HIGHSPEED,
-// .flags  = MSDC_SYS_SUSPEND | MSDC_WP_PIN_EN | MSDC_CD_PIN_EN | 
MSDC_REMOVABLE,
+   .flags  = MSDC_CD_PIN_EN | MSDC_REMOVABLE | MSDC_HIGHSPEED,
+// .flags  = MSDC_WP_PIN_EN | MSDC_CD_PIN_EN | MSDC_REMOVABLE,
 };
 
 /* end of +++ */
@@ -2700,7 +2700,7 @@ static int msdc_drv_probe(struct platform_device *pdev)
mmc->f_max  = HOST_MAX_MCLK;
mmc->ocr_avail  = MSDC_OCR_AVAIL;
 
-   /* For sd card: MSDC_SYS_SUSPEND | MSDC_WP_PIN_EN | MSDC_CD_PIN_EN | 
MSDC_REMOVABLE | MSDC_HIGHSPEED,
+   /* For sd card: MSDC_WP_PIN_EN | MSDC_CD_PIN_EN | MSDC_REMOVABLE | 
MSDC_HIGHSPEED,
   For sdio   : MSDC_EXT_SDIO_IRQ | MSDC_HIGHSPEED */
if (hw->flags & MSDC_HIGHSPEED)
mmc->caps   = MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED;
@@ -2874,7 +2874,7 @@ static void msdc_drv_pm(struct platform_device *pdev, 
pm_message_t state)
struct mmc_host *mmc = platform_get_drvdata(pdev);
struct msdc_host *host = mmc_priv(mmc);
 
-   if (mmc && (host->hw->flags & MSDC_SYS_SUSPEND))
+   if (mmc)
msdc_pm(state, (void *)host);
 }
 
-- 
2.16.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v2 09/10] staging: mt7621-mmc: Fix: copy_from_user() returns a positive value

2018-04-07 Thread Christian Lütke-Stetzkamp
copy_from_user() returns a positive value in case of an error, to fix
this the check is turned around, also a better return value is chosen.

Reported-by: Dan Carpenter 
Suggested-by: Dan Carpenter 
Signed-off-by: Christian Lütke-Stetzkamp 
Reviewed-by: NeilBrown 
---
 drivers/staging/mt7621-mmc/dbg.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/mt7621-mmc/dbg.c b/drivers/staging/mt7621-mmc/dbg.c
index ec95f6d49997..9a1809d74ea3 100644
--- a/drivers/staging/mt7621-mmc/dbg.c
+++ b/drivers/staging/mt7621-mmc/dbg.c
@@ -265,9 +265,8 @@ static ssize_t msdc_debug_proc_write(struct file *file,
if (count > 255)
count = 255;
 
-   ret = copy_from_user(cmd_buf, buf, count);
-   if (ret < 0)
-   return -1;
+   if (copy_from_user(cmd_buf, buf, count))
+   return -EFAULT;
 
cmd_buf[count] = '\0';
printk("msdc Write %s\n", cmd_buf);
-- 
2.16.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v2 07/10] staging: mt7621-mmc: Remove error message in debug

2018-04-07 Thread Christian Lütke-Stetzkamp
If the debug file in proc fs is not successfully created current code
prints an error message, this is removed. de is also not an error
pointer, so the IS_ERR() call leads to a static checker warning. The
unused return value of the msdc_debug_proc_init function is also removed.

Reported-by: Dan Carpenter 
Signed-off-by: Christian Lütke-Stetzkamp 
Reviewed-by: NeilBrown 
---
 drivers/staging/mt7621-mmc/dbg.c | 9 ++---
 drivers/staging/mt7621-mmc/dbg.h | 2 +-
 2 files changed, 3 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/mt7621-mmc/dbg.c b/drivers/staging/mt7621-mmc/dbg.c
index abf92a84a417..3ef36ab7138d 100644
--- a/drivers/staging/mt7621-mmc/dbg.c
+++ b/drivers/staging/mt7621-mmc/dbg.c
@@ -337,14 +337,9 @@ static const struct file_operations msdc_debug_fops = {
.release= single_release,
 };
 
-int msdc_debug_proc_init(void)
+void msdc_debug_proc_init(void)
 {
-   struct proc_dir_entry *de = proc_create("msdc_debug", 0667, NULL, 
_debug_fops);
-
-   if (!de || IS_ERR(de))
-   printk("!! Create MSDC debug PROC fail !!\n");
-
-   return 0;
+   proc_create("msdc_debug", 0667, NULL, _debug_fops);
 }
 EXPORT_SYMBOL_GPL(msdc_debug_proc_init);
 #endif
diff --git a/drivers/staging/mt7621-mmc/dbg.h b/drivers/staging/mt7621-mmc/dbg.h
index 5469c9d16804..6f00fcdaba32 100644
--- a/drivers/staging/mt7621-mmc/dbg.h
+++ b/drivers/staging/mt7621-mmc/dbg.h
@@ -146,7 +146,7 @@ do { \
 } while (0);
 #endif
 
-int msdc_debug_proc_init(void);
+void msdc_debug_proc_init(void);
 
 #if 0 /* --- chhung */
 void msdc_init_gpt(void);
-- 
2.16.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v2 04/10] staging: mt7621-mmc: Remove unused functions

2018-04-07 Thread Christian Lütke-Stetzkamp
The functions msdc_eirq_cd and msdc_eirq_sdio are defined but never
used, so they are removed. This also fixes two compiler warnings:

drivers/staging/mt7621-mmc/sd.c:517:13: warning: ‘msdc_eirq_cd’ defined but
not used [-Wunused-function]
 static void msdc_eirq_cd(void *data)
 ^~~~
drivers/staging/mt7621-mmc/sd.c:507:13: warning: ‘msdc_eirq_sdio’ defined but
not used [-Wunused-function]
 static void msdc_eirq_sdio(void *data)

Signed-off-by: Christian Lütke-Stetzkamp 
Reviewed-by: NeilBrown 
---
 drivers/staging/mt7621-mmc/sd.c | 24 
 1 file changed, 24 deletions(-)

diff --git a/drivers/staging/mt7621-mmc/sd.c b/drivers/staging/mt7621-mmc/sd.c
index 73c1861ac539..4e98c61c145f 100644
--- a/drivers/staging/mt7621-mmc/sd.c
+++ b/drivers/staging/mt7621-mmc/sd.c
@@ -503,30 +503,6 @@ static void msdc_set_timeout(struct msdc_host *host, u32 
ns, u32 clks)
  ns, clks, timeout + 1);
 }
 
-/* msdc_eirq_sdio() will be called when EIRQ(for WIFI) */
-static void msdc_eirq_sdio(void *data)
-{
-   struct msdc_host *host = (struct msdc_host *)data;
-
-   N_MSG(INT, "SDIO EINT");
-
-   mmc_signal_sdio_irq(host->mmc);
-}
-
-/* msdc_eirq_cd will not be used!  We not using EINT for card detection. */
-static void msdc_eirq_cd(void *data)
-{
-   struct msdc_host *host = (struct msdc_host *)data;
-
-   N_MSG(INT, "CD EINT");
-
-#if 0
-   tasklet_hi_schedule(>card_tasklet);
-#else
-   schedule_delayed_work(>card_delaywork, HZ);
-#endif
-}
-
 #if 0
 static void msdc_tasklet_card(unsigned long arg)
 {
-- 
2.16.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v2 08/10] staging: mt7621-mmc: Fix debug file world writable

2018-04-07 Thread Christian Lütke-Stetzkamp
Currently the debug file in proc fs is world writable, remove the
access for other.

Reported-by: Dan Carpenter 
Signed-off-by: Christian Lütke-Stetzkamp 
Reviewed-by: NeilBrown 
---
 drivers/staging/mt7621-mmc/dbg.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/mt7621-mmc/dbg.c b/drivers/staging/mt7621-mmc/dbg.c
index 3ef36ab7138d..ec95f6d49997 100644
--- a/drivers/staging/mt7621-mmc/dbg.c
+++ b/drivers/staging/mt7621-mmc/dbg.c
@@ -339,7 +339,7 @@ static const struct file_operations msdc_debug_fops = {
 
 void msdc_debug_proc_init(void)
 {
-   proc_create("msdc_debug", 0667, NULL, _debug_fops);
+   proc_create("msdc_debug", 0660, NULL, _debug_fops);
 }
 EXPORT_SYMBOL_GPL(msdc_debug_proc_init);
 #endif
-- 
2.16.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v2 1/3] resource: Use list_head to link sibling resource

2018-04-07 Thread kbuild test robot
Hi Baoquan,

I love your patch! Yet something to improve:

[auto build test ERROR on linus/master]
[also build test ERROR on v4.16 next-20180406]
[if your patch is applied to the wrong git tree, please drop us a note to help 
improve the system]

url:
https://github.com/0day-ci/linux/commits/Baoquan-He/resource-Use-list_head-to-link-sibling-resource/20180408-110108
config: sparc-defconfig (attached as .config)
compiler: sparc-linux-gcc (GCC) 7.2.0
reproduce:
wget 
https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O 
~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=sparc 

All errors (new ones prefixed by >>):

   arch/sparc/kernel/ioport.c: In function 'sparc_io_proc_show':
>> arch/sparc/kernel/ioport.c:672:9: error: incompatible types when assigning 
>> to type 'struct resource *' from type 'struct list_head'
 for (r = root->child; r != NULL; r = r->sibling) {
^
   arch/sparc/kernel/ioport.c:672:37: error: incompatible types when assigning 
to type 'struct resource *' from type 'struct list_head'
 for (r = root->child; r != NULL; r = r->sibling) {
^

vim +672 arch/sparc/kernel/ioport.c

^1da177e4 Linus Torvalds 2005-04-16  666  
e7a088f93 Alexey Dobriyan2009-09-01  667  static int 
sparc_io_proc_show(struct seq_file *m, void *v)
^1da177e4 Linus Torvalds 2005-04-16  668  {
e7a088f93 Alexey Dobriyan2009-09-01  669struct resource *root = 
m->private, *r;
^1da177e4 Linus Torvalds 2005-04-16  670const char *nm;
^1da177e4 Linus Torvalds 2005-04-16  671  
e7a088f93 Alexey Dobriyan2009-09-01 @672for (r = root->child; r != 
NULL; r = r->sibling) {
c31f76518 Sam Ravnborg   2014-04-21  673if ((nm = r->name) == 
NULL) nm = "???";
e7a088f93 Alexey Dobriyan2009-09-01  674seq_printf(m, 
"%016llx-%016llx: %s\n",
685143ac1 Greg Kroah-Hartman 2006-06-12  675
(unsigned long long)r->start,
685143ac1 Greg Kroah-Hartman 2006-06-12  676
(unsigned long long)r->end, nm);
^1da177e4 Linus Torvalds 2005-04-16  677}
^1da177e4 Linus Torvalds 2005-04-16  678  
e7a088f93 Alexey Dobriyan2009-09-01  679return 0;
^1da177e4 Linus Torvalds 2005-04-16  680  }
^1da177e4 Linus Torvalds 2005-04-16  681  

:: The code at line 672 was first introduced by commit
:: e7a088f935180b90cfe6ab0aaae8a556f46885fe sparc: convert /proc/io_map, 
/proc/dvma_map to seq_file

:: TO: Alexey Dobriyan 
:: CC: David S. Miller 

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation


.config.gz
Description: application/gzip
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] staging: vt6655: remove unnecessary line breaks in function definition.

2018-04-07 Thread Danilo Alves
This patch corrects the function definition style of CARDvSafeResetRx.
Issue found by checkpatch.

CHECK: Lines should not end with a '('

Signed-off-by: Danilo Alves 
---
 drivers/staging/vt6655/card.c | 5 +
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/staging/vt6655/card.c b/drivers/staging/vt6655/card.c
index ea0a4b57852c..52e9e6b90b56 100644
--- a/drivers/staging/vt6655/card.c
+++ b/drivers/staging/vt6655/card.c
@@ -557,10 +557,7 @@ CARDvSafeResetTx(
  *
  * Return Value: none
  */
-void
-CARDvSafeResetRx(
-   struct vnt_private *priv
-)
+void CARDvSafeResetRx(struct vnt_private *priv)
 {
unsigned int uu;
struct vnt_rx_desc *pDesc;
-- 
2.11.0

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v2 1/3] resource: Use list_head to link sibling resource

2018-04-07 Thread kbuild test robot
Hi Baoquan,

I love your patch! Yet something to improve:

[auto build test ERROR on linus/master]
[also build test ERROR on v4.16 next-20180406]
[if your patch is applied to the wrong git tree, please drop us a note to help 
improve the system]

url:
https://github.com/0day-ci/linux/commits/Baoquan-He/resource-Use-list_head-to-link-sibling-resource/20180408-110108
config: parisc-c3000_defconfig (attached as .config)
compiler: hppa-linux-gnu-gcc (Debian 7.2.0-11) 7.2.0
reproduce:
wget 
https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O 
~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=parisc 

All errors (new ones prefixed by >>):

   drivers//parisc/lba_pci.c: In function 'lba_dump_res':
>> drivers//parisc/lba_pci.c:173:15: error: incompatible type for argument 1 of 
>> 'lba_dump_res'
 lba_dump_res(r->child, d+2);
  ^
   drivers//parisc/lba_pci.c:162:1: note: expected 'struct resource *' but 
argument is of type 'struct list_head'
lba_dump_res(struct resource *r, int d)
^~~~
   drivers//parisc/lba_pci.c:174:15: error: incompatible type for argument 1 of 
'lba_dump_res'
 lba_dump_res(r->sibling, d);
  ^
   drivers//parisc/lba_pci.c:162:1: note: expected 'struct resource *' but 
argument is of type 'struct list_head'
lba_dump_res(struct resource *r, int d)
^~~~

vim +/lba_dump_res +173 drivers//parisc/lba_pci.c

^1da177e Linus Torvalds 2005-04-16  159  
^1da177e Linus Torvalds 2005-04-16  160  
^1da177e Linus Torvalds 2005-04-16  161  static void
^1da177e Linus Torvalds 2005-04-16  162  lba_dump_res(struct resource *r, int d)
^1da177e Linus Torvalds 2005-04-16  163  {
^1da177e Linus Torvalds 2005-04-16  164 int i;
^1da177e Linus Torvalds 2005-04-16  165  
^1da177e Linus Torvalds 2005-04-16  166 if (NULL == r)
^1da177e Linus Torvalds 2005-04-16  167 return;
^1da177e Linus Torvalds 2005-04-16  168  
^1da177e Linus Torvalds 2005-04-16  169 printk(KERN_DEBUG "(%p)", 
r->parent);
^1da177e Linus Torvalds 2005-04-16  170 for (i = d; i ; --i) printk(" 
");
645d11d4 Matthew Wilcox 2006-12-24  171 printk(KERN_DEBUG "%p 
[%lx,%lx]/%lx\n", r,
645d11d4 Matthew Wilcox 2006-12-24  172 (long)r->start, 
(long)r->end, r->flags);
^1da177e Linus Torvalds 2005-04-16 @173 lba_dump_res(r->child, d+2);
^1da177e Linus Torvalds 2005-04-16  174 lba_dump_res(r->sibling, d);
^1da177e Linus Torvalds 2005-04-16  175  }
^1da177e Linus Torvalds 2005-04-16  176  

:: The code at line 173 was first introduced by commit
:: 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 Linux-2.6.12-rc2

:: TO: Linus Torvalds 
:: CC: Linus Torvalds 

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation


.config.gz
Description: application/gzip
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


your images need editing and

2018-04-07 Thread Sam

We have been hailed as one of the top-tier photo retouching service
providers in the world, supplying
its tremendous expertise to more than 20 nations, and catering to myriad
industry needs that include
E-Commerce, Photography, and stock photo. Handling high volumes maintaining
the highest standards
within the deadlines is our motto, thus far we are successfully processing
close to 100,000 images a month.

We assure you the quality in the retouching services.

What we do:
Clipping path; Deep etch process
Image masking
Remove background
Portrait retouching
Jewelry photo retouching
Fashion photo retouching

We can provide you editing test on your photos.
Please reply if you are interested.

Thanks,
Sam

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v2 1/3] resource: Use list_head to link sibling resource

2018-04-07 Thread Baoquan He
The struct resource uses singly linked list to link siblings. It's not
easy to do reverse iteration on sibling list. So replace it with list_head.

And this makes codes in kernel/resource.c more readable after refactoring
than pointer operation.

Suggested-by: Andrew Morton 
Signed-off-by: Baoquan He 
Cc: Patrik Jakobsson 
Cc: David Airlie 
Cc: "K. Y. Srinivasan" 
Cc: Haiyang Zhang 
Cc: Stephen Hemminger 
Cc: Dmitry Torokhov 
Cc: Dan Williams 
Cc: Rob Herring 
Cc: Frank Rowand 
Cc: Keith Busch 
Cc: Jonathan Derrick 
Cc: Lorenzo Pieralisi 
Cc: Bjorn Helgaas 
Cc: Thomas Gleixner 
Cc: Brijesh Singh 
Cc: "Jérôme Glisse" 
Cc: Borislav Petkov 
Cc: Tom Lendacky 
Cc: Greg Kroah-Hartman 
Cc: Yaowei Bai 
Cc: Wei Yang 
Cc: de...@linuxdriverproject.org
Cc: linux-in...@vger.kernel.org
Cc: linux-nvd...@lists.01.org
Cc: devicet...@vger.kernel.org
Cc: linux-...@vger.kernel.org
---
 drivers/gpu/drm/gma500/gtt.c|   5 +-
 drivers/hv/vmbus_drv.c  |  52 
 drivers/input/joystick/iforce/iforce-main.c |   4 +-
 drivers/nvdimm/e820.c   |   2 +-
 drivers/nvdimm/namespace_devs.c |  14 +-
 drivers/nvdimm/nd.h |   5 +-
 drivers/of/address.c|   4 +-
 drivers/pci/host/vmd.c  |   8 +-
 drivers/pci/probe.c |   2 +
 drivers/pci/setup-bus.c |   2 +-
 include/linux/ioport.h  |   4 +-
 kernel/resource.c   | 193 ++--
 12 files changed, 151 insertions(+), 144 deletions(-)

diff --git a/drivers/gpu/drm/gma500/gtt.c b/drivers/gpu/drm/gma500/gtt.c
index 3949b0990916..addd3bc009af 100644
--- a/drivers/gpu/drm/gma500/gtt.c
+++ b/drivers/gpu/drm/gma500/gtt.c
@@ -565,7 +565,7 @@ int psb_gtt_init(struct drm_device *dev, int resume)
 int psb_gtt_restore(struct drm_device *dev)
 {
struct drm_psb_private *dev_priv = dev->dev_private;
-   struct resource *r = dev_priv->gtt_mem->child;
+   struct resource *r;
struct gtt_range *range;
unsigned int restored = 0, total = 0, size = 0;
 
@@ -573,14 +573,13 @@ int psb_gtt_restore(struct drm_device *dev)
mutex_lock(_priv->gtt_mutex);
psb_gtt_init(dev, 1);
 
-   while (r != NULL) {
+   list_for_each_entry(r, _priv->gtt_mem->child, sibling) {
range = container_of(r, struct gtt_range, resource);
if (range->pages) {
psb_gtt_insert(dev, range, 1);
size += range->resource.end - range->resource.start;
restored++;
}
-   r = r->sibling;
total++;
}
mutex_unlock(_priv->gtt_mutex);
diff --git a/drivers/hv/vmbus_drv.c b/drivers/hv/vmbus_drv.c
index bc65c4d79c1f..7ba8a25520d9 100644
--- a/drivers/hv/vmbus_drv.c
+++ b/drivers/hv/vmbus_drv.c
@@ -1413,9 +1413,8 @@ static acpi_status vmbus_walk_resources(struct 
acpi_resource *res, void *ctx)
 {
resource_size_t start = 0;
resource_size_t end = 0;
-   struct resource *new_res;
+   struct resource *new_res, *tmp;
struct resource **old_res = _mmio;
-   struct resource **prev_res = NULL;
 
switch (res->type) {
 
@@ -1462,44 +1461,36 @@ static acpi_status vmbus_walk_resources(struct 
acpi_resource *res, void *ctx)
/*
 * If two ranges are adjacent, merge them.
 */
-   do {
-   if (!*old_res) {
-   *old_res = new_res;
-   break;
-   }
-
-   if (((*old_res)->end + 1) == new_res->start) {
-   (*old_res)->end = new_res->end;
+   if (!*old_res) {
+   *old_res = new_res;
+   return AE_OK;
+   }
+   tmp = *old_res;
+   list_for_each_entry_from(tmp, >parent->child, sibling) {
+   if ((tmp->end + 1) == new_res->start) {
+   tmp->end = new_res->end;
kfree(new_res);
break;
}
 
-   if ((*old_res)->start == new_res->end + 1) {
-   (*old_res)->start = new_res->start;
+   if (tmp->start == new_res->end + 1) {
+   tmp->start = new_res->start;
kfree(new_res);
break;
}
 
-