Skip to contentSkip to conversation

mmc: sdhci-s3c: remove unnecessary/dupulicated code

PATCH In review Jaehoon Chung 3 participants 6 messages Dec 5, 2011

Subsystems (3)
lore
Share & tools
lore

Jaehoon Chung

author maintainer
#0 lore raw

PATCH 1/1 mmc: sdhci-s3c: remove unnecessary/dupulicated code

This patch is just removed the unnecessary code.

---
 drivers/mmc/host/sdhci-s3c.c |    7 +------
 1 files changed, 1 insertions(+), 6 deletions(-)
drivers/mmc/host/sdhci-s3c.c +1 -6
index b6558b8..ad0ef39 100644
@@ -334,11 +334,9 @@ static void sdhci_s3c_notify_change(struct platform_device *dev, int state)
 		spin_lock_irqsave(&host->lock, flags);
 		if (state) {
 			dev_dbg(&dev->dev, "card inserted.\n");
-			host->flags &= ~SDHCI_DEVICE_DEAD;
 			host->quirks |= SDHCI_QUIRK_BROKEN_CARD_DETECTION;
 		} else {
 			dev_dbg(&dev->dev, "card removed.\n");
-			host->flags |= SDHCI_DEVICE_DEAD;
 			host->quirks &= ~SDHCI_QUIRK_BROKEN_CARD_DETECTION;
 		}
 		tasklet_schedule(&host->card_tasklet);
@@ -521,6 +519,7 @@ static int __devinit sdhci_s3c_probe(struct platform_device *pdev)
 	if (pdata->cd_type == S3C_SDHCI_CD_PERMANENT)
 		host->mmc->caps = MMC_CAP_NONREMOVABLE;
 
+	/* It supports additional host capabilities if needed */
 	if (pdata->host_caps)
 		host->mmc->caps |= pdata->host_caps;
 
@@ -543,10 +542,6 @@ static int __devinit sdhci_s3c_probe(struct platform_device *pdev)
 		sdhci_s3c_ops.get_max_clock = sdhci_cmu_get_max_clock;
 	}
 
-	/* It supports additional host capabilities if needed */
-	if (pdata->host_caps)
-		host->mmc->caps |= pdata->host_caps;
-
 	ret = sdhci_add_host(host);
 	if (ret) {
 		dev_err(dev, "sdhci_add_host() failed\n");
#1 lore raw

Hi Jaehoon,

Quoted 13 lines

This patch is just removed the unnecessary code.

---
 drivers/mmc/host/sdhci-s3c.c |    7 +------
 1 files changed, 1 insertions(+), 6 deletions(-)
drivers/mmc/host/sdhci-s3c.c +0 -0
index b6558b8..ad0ef39 100644

drivers/mmc/host/sdhci-s3c.c static void sdhci_s3c_notify_change(struct platform_device *dev, int state) · line 341

Quoted 10 lines
drivers/mmc/host/sdhci-s3c.c +0 -2
@@ -334,11 +334,9 @@ static void sdhci_s3c_notify_change(struct platform_device *dev, int state)
 		spin_lock_irqsave(&host->lock, flags);
 		if (state) {
 			dev_dbg(&dev->dev, "card inserted.\n");
-			host->flags &= ~SDHCI_DEVICE_DEAD;
 			host->quirks |= SDHCI_QUIRK_BROKEN_CARD_DETECTION;
 		} else {
 			dev_dbg(&dev->dev, "card removed.\n");
-			host->flags |= SDHCI_DEVICE_DEAD;
 			host->quirks &= ~SDHCI_QUIRK_BROKEN_CARD_DETECTION;
 		}

Could you explain the reason of these remove? SDHCI_DEVICE_DEAD flag is needed for external card detection and is used in "sdhci.c".

Best regards,
Seungwon Jeon.

Quoted 24 lines
drivers/mmc/host/sdhci-s3c.c +1 -5
 		tasklet_schedule(&host->card_tasklet);
@@ -521,6 +519,7 @@ static int __devinit sdhci_s3c_probe(struct platform_device *pdev)
 	if (pdata->cd_type == S3C_SDHCI_CD_PERMANENT)
 		host->mmc->caps = MMC_CAP_NONREMOVABLE;
 
+	/* It supports additional host capabilities if needed */
 	if (pdata->host_caps)
 		host->mmc->caps |= pdata->host_caps;
 
@@ -543,10 +542,6 @@ static int __devinit sdhci_s3c_probe(struct platform_device *pdev)
 		sdhci_s3c_ops.get_max_clock = sdhci_cmu_get_max_clock;
 	}
 
-	/* It supports additional host capabilities if needed */
-	if (pdata->host_caps)
-		host->mmc->caps |= pdata->host_caps;
-
 	ret = sdhci_add_host(host);
 	if (ret) {
 		dev_err(dev, "sdhci_add_host() failed\n");
--

To unsubscribe from this list: send the line "unsubscribe linux-mmc" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

author maintainer
#2 lore raw

Hi Seungwon

Quoted 19 lines · Seungwon Jeon

Hi Jaehoon,

Quoted 18 lines

This patch is just removed the unnecessary code.

---
 drivers/mmc/host/sdhci-s3c.c |    7 +------
 1 files changed, 1 insertions(+), 6 deletions(-)
drivers/mmc/host/sdhci-s3c.c +0 -1
index b6558b8..ad0ef39 100644
@@ -334,11 +334,9 @@ static void sdhci_s3c_notify_change(struct platform_device *dev, int state)
 		spin_lock_irqsave(&host->lock, flags);
 		if (state) {
 			dev_dbg(&dev->dev, "card inserted.\n");
-			host->flags &= ~SDHCI_DEVICE_DEAD;
 			host->quirks |= SDHCI_QUIRK_BROKEN_CARD_DETECTION;
Quoted 8 lines

drivers/mmc/host/sdhci-s3c.c static void sdhci_s3c_notify_change(struct platform_device *dev, int state) · line 341

Quoted 5 lines
drivers/mmc/host/sdhci-s3c.c +0 -1
 		} else {
 			dev_dbg(&dev->dev, "card removed.\n");
-			host->flags |= SDHCI_DEVICE_DEAD;
 			host->quirks &= ~SDHCI_QUIRK_BROKEN_CARD_DETECTION;
 		}

Could you explain the reason of these remove? SDHCI_DEVICE_DEAD flag is needed for external card detection and is used in "sdhci.c".

I didn't know why this flag is assigned
I found that if this flag is set when card is removed, ENSDCLK bit in CLOCK control register is always set in sdhci_set_ios(). If device dead, be skipped set_ios.
(In my case, when i use SD clock-gating, this flag is problem.)

Best regards,
Jaehoon Chung

Quoted 30 lines

Best regards,
Seungwon Jeon.

Quoted 24 lines
drivers/mmc/host/sdhci-s3c.c +1 -5
 		tasklet_schedule(&host->card_tasklet);
@@ -521,6 +519,7 @@ static int __devinit sdhci_s3c_probe(struct platform_device *pdev)
 	if (pdata->cd_type == S3C_SDHCI_CD_PERMANENT)
 		host->mmc->caps = MMC_CAP_NONREMOVABLE;
 
+	/* It supports additional host capabilities if needed */
 	if (pdata->host_caps)
 		host->mmc->caps |= pdata->host_caps;
 
@@ -543,10 +542,6 @@ static int __devinit sdhci_s3c_probe(struct platform_device *pdev)
 		sdhci_s3c_ops.get_max_clock = sdhci_cmu_get_max_clock;
 	}
 
-	/* It supports additional host capabilities if needed */
-	if (pdata->host_caps)
-		host->mmc->caps |= pdata->host_caps;
-
 	ret = sdhci_add_host(host);
 	if (ret) {
 		dev_err(dev, "sdhci_add_host() failed\n");
--

To unsubscribe from this list: send the line "unsubscribe linux-mmc" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

author maintainer
#3 lore raw

And that flag didn't affect anywhere..in my case..

If you know why use this flag, i don't remove this flag.

Thanks,
Jaehoon Chung

Quoted 79 lines · Jaehoon Chung

Hi Seungwon

Quoted 19 lines · Seungwon Jeon

Hi Jaehoon,

Quoted 18 lines

This patch is just removed the unnecessary code.

---
 drivers/mmc/host/sdhci-s3c.c |    7 +------
 1 files changed, 1 insertions(+), 6 deletions(-)
drivers/mmc/host/sdhci-s3c.c +0 -1
index b6558b8..ad0ef39 100644
@@ -334,11 +334,9 @@ static void sdhci_s3c_notify_change(struct platform_device *dev, int state)
 		spin_lock_irqsave(&host->lock, flags);
 		if (state) {
 			dev_dbg(&dev->dev, "card inserted.\n");
-			host->flags &= ~SDHCI_DEVICE_DEAD;
 			host->quirks |= SDHCI_QUIRK_BROKEN_CARD_DETECTION;
Quoted 8 lines

drivers/mmc/host/sdhci-s3c.c static void sdhci_s3c_notify_change(struct platform_device *dev, int state) · line 341

Quoted 5 lines
drivers/mmc/host/sdhci-s3c.c +0 -1
 		} else {
 			dev_dbg(&dev->dev, "card removed.\n");
-			host->flags |= SDHCI_DEVICE_DEAD;
 			host->quirks &= ~SDHCI_QUIRK_BROKEN_CARD_DETECTION;
 		}

Could you explain the reason of these remove? SDHCI_DEVICE_DEAD flag is needed for external card detection and is used in "sdhci.c".

I didn't know why this flag is assigned
I found that if this flag is set when card is removed, ENSDCLK bit in CLOCK control register is always set in sdhci_set_ios(). If device dead, be skipped set_ios.
(In my case, when i use SD clock-gating, this flag is problem.)

Best regards,
Jaehoon Chung

Quoted 17 lines

Best regards,
Seungwon Jeon.

Quoted 13 lines
drivers/mmc/host/sdhci-s3c.c +1 -0
 		tasklet_schedule(&host->card_tasklet);
@@ -521,6 +519,7 @@ static int __devinit sdhci_s3c_probe(struct platform_device *pdev)
 	if (pdata->cd_type == S3C_SDHCI_CD_PERMANENT)
 		host->mmc->caps = MMC_CAP_NONREMOVABLE;
 
+	/* It supports additional host capabilities if needed */
 	if (pdata->host_caps)
 		host->mmc->caps |= pdata->host_caps;
 
@@ -543,10 +542,6 @@ static int __devinit sdhci_s3c_probe(struct platform_device *pdev)
 		sdhci_s3c_ops.get_max_clock = sdhci_cmu_get_max_clock;
 	}
 
Quoted 13 lines
Quoted 11 lines
drivers/mmc/host/sdhci-s3c.c +0 -5
-	/* It supports additional host capabilities if needed */
-	if (pdata->host_caps)
-		host->mmc->caps |= pdata->host_caps;
-
 	ret = sdhci_add_host(host);
 	if (ret) {
 		dev_err(dev, "sdhci_add_host() failed\n");
--

To unsubscribe from this list: send the line "unsubscribe linux-mmc" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#4 lore raw
Quoted 3 lines · Jaehoon Chung

And that flag didn't affect anywhere..in my case..

If you know why use this flag, i don't remove this flag.

For the external card detection, this flag indicates whether a card is inserted or not. I found sdhci_do_set_ios() checks only "SDHCI_DEVICE_DEAD".
That means it doesn't consider the case of internal CD's state.
How about approaching the sdhci_do_set_ios() for your problem?

Thanks,
Seungwon Jeon.

Quoted 91 lines

Thanks,
Jaehoon Chung

Quoted 74 lines · Jaehoon Chung

Hi Seungwon

Quoted 19 lines · Seungwon Jeon

Hi Jaehoon,

Quoted 18 lines

This patch is just removed the unnecessary code.

---
 drivers/mmc/host/sdhci-s3c.c |    7 +------
 1 files changed, 1 insertions(+), 6 deletions(-)
drivers/mmc/host/sdhci-s3c.c +0 -1
index b6558b8..ad0ef39 100644
@@ -334,11 +334,9 @@ static void sdhci_s3c_notify_change(struct platform_device *dev, int state)
 		spin_lock_irqsave(&host->lock, flags);
 		if (state) {
 			dev_dbg(&dev->dev, "card inserted.\n");
-			host->flags &= ~SDHCI_DEVICE_DEAD;
 			host->quirks |= SDHCI_QUIRK_BROKEN_CARD_DETECTION;
Quoted 8 lines

drivers/mmc/host/sdhci-s3c.c static void sdhci_s3c_notify_change(struct platform_device *dev, int state) · line 341

Quoted 5 lines
drivers/mmc/host/sdhci-s3c.c +0 -1
 		} else {
 			dev_dbg(&dev->dev, "card removed.\n");
-			host->flags |= SDHCI_DEVICE_DEAD;
 			host->quirks &= ~SDHCI_QUIRK_BROKEN_CARD_DETECTION;
 		}

Could you explain the reason of these remove? SDHCI_DEVICE_DEAD flag is needed for external card detection and is used in "sdhci.c".

I didn't know why this flag is assigned
I found that if this flag is set when card is removed, ENSDCLK bit in CLOCK control register is always set in sdhci_set_ios(). If device dead, be skipped set_ios.
(In my case, when i use SD clock-gating, this flag is problem.)

Best regards,
Jaehoon Chung

Quoted 17 lines

Best regards,
Seungwon Jeon.

Quoted 13 lines
drivers/mmc/host/sdhci-s3c.c +1 -0
 		tasklet_schedule(&host->card_tasklet);
@@ -521,6 +519,7 @@ static int __devinit sdhci_s3c_probe(struct platform_device *pdev)
 	if (pdata->cd_type == S3C_SDHCI_CD_PERMANENT)
 		host->mmc->caps = MMC_CAP_NONREMOVABLE;
 
+	/* It supports additional host capabilities if needed */
 	if (pdata->host_caps)
 		host->mmc->caps |= pdata->host_caps;
 
@@ -543,10 +542,6 @@ static int __devinit sdhci_s3c_probe(struct platform_device *pdev)
 		sdhci_s3c_ops.get_max_clock = sdhci_cmu_get_max_clock;
 	}
 
Quoted 13 lines
Quoted 11 lines
drivers/mmc/host/sdhci-s3c.c +0 -5
-	/* It supports additional host capabilities if needed */
-	if (pdata->host_caps)
-		host->mmc->caps |= pdata->host_caps;
-
 	ret = sdhci_add_host(host);
 	if (ret) {
 		dev_err(dev, "sdhci_add_host() failed\n");
--

To unsubscribe from this list: send the line "unsubscribe linux-mmc" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

Quoted 5 lines

--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#5 lore raw

Hi Seungwon

2011/12/5 Seungwon Jeon <[email protected]>:

Quoted 8 lines
Quoted 3 lines · Jaehoon Chung

And that flag didn't affect anywhere..in my case..

If you know why use this flag, i don't remove this flag.

For the external card detection, this flag indicates whether a card is inserted or not. I found sdhci_do_set_ios() checks only "SDHCI_DEVICE_DEAD".
That means it doesn't consider the case of internal CD's state.
How about approaching the sdhci_do_set_ios() for your problem?

I didn't consider the case of CDn detect..
I will consider your opinion..
Thanks for your comment..

Best regards,
Jaehoon Chung

Quoted 100 lines

Thanks,
Seungwon Jeon.

Quoted 87 lines

Thanks,
Jaehoon Chung

Quoted 74 lines · Jaehoon Chung

Hi Seungwon

Quoted 19 lines · Seungwon Jeon

Hi Jaehoon,

Quoted 18 lines

This patch is just removed the unnecessary code.

---
 drivers/mmc/host/sdhci-s3c.c |    7 +------

 1 files changed, 1 insertions(+), 6 deletions(-)
drivers/mmc/host/sdhci-s3c.c +0 -1
index b6558b8..ad0ef39 100644
@@ -334,11 +334,9 @@ static void sdhci_s3c_notify_change(struct platform_device *dev, int state)
           spin_lock_irqsave(&host->lock, flags);
           if (state) {
                   dev_dbg(&dev->dev, "card inserted.\n");
-                 host->flags &= ~SDHCI_DEVICE_DEAD;
                   host->quirks |= SDHCI_QUIRK_BROKEN_CARD_DETECTION;
Quoted 8 lines

drivers/mmc/host/sdhci-s3c.c static void sdhci_s3c_notify_change(struct platform_device *dev, int state) · line 341

Quoted 5 lines
drivers/mmc/host/sdhci-s3c.c +0 -1
           } else {
                   dev_dbg(&dev->dev, "card removed.\n");
-                 host->flags |= SDHCI_DEVICE_DEAD;
                   host->quirks &= ~SDHCI_QUIRK_BROKEN_CARD_DETECTION;
           }

Could you explain the reason of these remove? SDHCI_DEVICE_DEAD flag is needed for external card detection and is used in "sdhci.c".

I didn't know why this flag is assigned
I found that if this flag is set when card is removed, ENSDCLK bit in CLOCK control register is always set in sdhci_set_ios(). If device dead, be skipped set_ios.
(In my case, when i use SD clock-gating, this flag is problem.)

Best regards,
Jaehoon Chung

Quoted 17 lines

Best regards,
Seungwon Jeon.

Quoted 13 lines
drivers/mmc/host/sdhci-s3c.c +1 -0
           tasklet_schedule(&host->card_tasklet);
@@ -521,6 +519,7 @@ static int __devinit sdhci_s3c_probe(struct platform_device *pdev)
   if (pdata->cd_type == S3C_SDHCI_CD_PERMANENT)
           host->mmc->caps = MMC_CAP_NONREMOVABLE;
 
+ /* It supports additional host capabilities if needed */
   if (pdata->host_caps)
           host->mmc->caps |= pdata->host_caps;
 
@@ -543,10 +542,6 @@ static int __devinit sdhci_s3c_probe(struct platform_device *pdev)
           sdhci_s3c_ops.get_max_clock = sdhci_cmu_get_max_clock;
   }
 
Quoted 13 lines
Quoted 11 lines
drivers/mmc/host/sdhci-s3c.c +0 -5
- /* It supports additional host capabilities if needed */
- if (pdata->host_caps)
-         host->mmc->caps |= pdata->host_caps;
-
   ret = sdhci_add_host(host);
   if (ret) {
           dev_err(dev, "sdhci_add_host() failed\n");
--

To unsubscribe from this list: send the line "unsubscribe linux-mmc" in the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Quoted 5 lines

--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Quoted 4 lines

--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html