diff mbox

[1/5] mmc: core: change quirks.c to be a header file

Message ID 1486456043-105954-2-git-send-email-shawn.lin@rock-chips.com (mailing list archive)
State New, archived
Headers show

Commit Message

Shawn Lin Feb. 7, 2017, 8:27 a.m. UTC
Rename quirks.c to quirks.h, and include it for
individual C files which need it.

Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
---

 drivers/mmc/core/Makefile               | 2 +-
 drivers/mmc/core/block.c                | 1 +
 drivers/mmc/core/card.h                 | 2 --
 drivers/mmc/core/mmc.c                  | 1 +
 drivers/mmc/core/{quirks.c => quirks.h} | 4 ++--
 drivers/mmc/core/sdio.c                 | 1 +
 6 files changed, 6 insertions(+), 5 deletions(-)
 rename drivers/mmc/core/{quirks.c => quirks.h} (95%)

Comments

Ulf Hansson Feb. 7, 2017, 9:22 a.m. UTC | #1
On 7 February 2017 at 09:27, Shawn Lin <shawn.lin@rock-chips.com> wrote:
> Rename quirks.c to quirks.h, and include it for
> individual C files which need it.
>
> Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
> ---
>
>  drivers/mmc/core/Makefile               | 2 +-
>  drivers/mmc/core/block.c                | 1 +
>  drivers/mmc/core/card.h                 | 2 --
>  drivers/mmc/core/mmc.c                  | 1 +
>  drivers/mmc/core/{quirks.c => quirks.h} | 4 ++--
>  drivers/mmc/core/sdio.c                 | 1 +
>  6 files changed, 6 insertions(+), 5 deletions(-)
>  rename drivers/mmc/core/{quirks.c => quirks.h} (95%)
>
> diff --git a/drivers/mmc/core/Makefile b/drivers/mmc/core/Makefile
> index 0f81464..7e3ed1a 100644
> --- a/drivers/mmc/core/Makefile
> +++ b/drivers/mmc/core/Makefile
> @@ -7,7 +7,7 @@ mmc_core-y                      := core.o bus.o host.o \
>                                    mmc.o mmc_ops.o sd.o sd_ops.o \
>                                    sdio.o sdio_ops.o sdio_bus.o \
>                                    sdio_cis.o sdio_io.o sdio_irq.o \
> -                                  quirks.o slot-gpio.o
> +                                  slot-gpio.o
>  mmc_core-$(CONFIG_OF)          += pwrseq.o
>  obj-$(CONFIG_PWRSEQ_SIMPLE)    += pwrseq_simple.o
>  obj-$(CONFIG_PWRSEQ_SD8787)    += pwrseq_sd8787.o
> diff --git a/drivers/mmc/core/block.c b/drivers/mmc/core/block.c
> index 985477c..ce5e2a2 100644
> --- a/drivers/mmc/core/block.c
> +++ b/drivers/mmc/core/block.c
> @@ -52,6 +52,7 @@
>  #include "host.h"
>  #include "bus.h"
>  #include "mmc_ops.h"
> +#include "quirks.h"
>  #include "sd_ops.h"
>
>  MODULE_ALIAS("mmc:block");
> diff --git a/drivers/mmc/core/card.h b/drivers/mmc/core/card.h
> index 95e8fc5..f06cd91 100644
> --- a/drivers/mmc/core/card.h
> +++ b/drivers/mmc/core/card.h
> @@ -218,6 +218,4 @@ static inline int mmc_card_broken_hpi(const struct mmc_card *c)
>         return c->quirks & MMC_QUIRK_BROKEN_HPI;
>  }
>
> -void mmc_fixup_device(struct mmc_card *card, const struct mmc_fixup *table);
> -
>  #endif
> diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c
> index f1a451e..d0e6b6f 100644
> --- a/drivers/mmc/core/mmc.c
> +++ b/drivers/mmc/core/mmc.c
> @@ -25,6 +25,7 @@
>  #include "host.h"
>  #include "bus.h"
>  #include "mmc_ops.h"
> +#include "quirks.h"
>  #include "sd_ops.h"
>
>  #define DEFAULT_CMD6_TIMEOUT_MS        500
> diff --git a/drivers/mmc/core/quirks.c b/drivers/mmc/core/quirks.h
> similarity index 95%
> rename from drivers/mmc/core/quirks.c
> rename to drivers/mmc/core/quirks.h
> index bf25a9c..dee83e7 100644
> --- a/drivers/mmc/core/quirks.c
> +++ b/drivers/mmc/core/quirks.h
> @@ -53,7 +53,8 @@
>         END_FIXUP
>  };
>
> -void mmc_fixup_device(struct mmc_card *card, const struct mmc_fixup *table)
> +static void mmc_fixup_device(struct mmc_card *card,
> +                            const struct mmc_fixup *table)

This should be "static inline void".


>  {
>         const struct mmc_fixup *f;
>         u64 rev = cid_rev_card(card);
> @@ -82,4 +83,3 @@ void mmc_fixup_device(struct mmc_card *card, const struct mmc_fixup *table)
>                 }
>         }
>  }
> -EXPORT_SYMBOL(mmc_fixup_device);

Because you turn this into a header file, I think you should try to
compile that header standalone (create a local c-file, include the
quirks.h and compile it). Make sure you get no errors/warnings.

Moreover, please go over a check what files that really needs to be
included from the new quirk.h, certainly some isn't needed but some
other are. The above trick for building the header file standalone,
helps to verify these changes.


> diff --git a/drivers/mmc/core/sdio.c b/drivers/mmc/core/sdio.c
> index a64a870..f092a55 100644
> --- a/drivers/mmc/core/sdio.c
> +++ b/drivers/mmc/core/sdio.c
> @@ -23,6 +23,7 @@
>  #include "card.h"
>  #include "host.h"
>  #include "bus.h"
> +#include "quirks.h"
>  #include "sd.h"
>  #include "sdio_bus.h"
>  #include "mmc_ops.h"
> --
> 1.9.1
>
>

Kind regards
Uffe
--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Shawn Lin Feb. 7, 2017, 9:39 a.m. UTC | #2
Hi Uffe,

On 2017/2/7 17:22, Ulf Hansson wrote:
> On 7 February 2017 at 09:27, Shawn Lin <shawn.lin@rock-chips.com> wrote:
>> Rename quirks.c to quirks.h, and include it for
>> individual C files which need it.
>>
>> Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
>> ---
>>
>>  drivers/mmc/core/Makefile               | 2 +-
>>  drivers/mmc/core/block.c                | 1 +
>>  drivers/mmc/core/card.h                 | 2 --
>>  drivers/mmc/core/mmc.c                  | 1 +
>>  drivers/mmc/core/{quirks.c => quirks.h} | 4 ++--
>>  drivers/mmc/core/sdio.c                 | 1 +
>>  6 files changed, 6 insertions(+), 5 deletions(-)
>>  rename drivers/mmc/core/{quirks.c => quirks.h} (95%)
>>
>> diff --git a/drivers/mmc/core/Makefile b/drivers/mmc/core/Makefile
>> index 0f81464..7e3ed1a 100644
>> --- a/drivers/mmc/core/Makefile
>> +++ b/drivers/mmc/core/Makefile
>> @@ -7,7 +7,7 @@ mmc_core-y                      := core.o bus.o host.o \
>>                                    mmc.o mmc_ops.o sd.o sd_ops.o \
>>                                    sdio.o sdio_ops.o sdio_bus.o \
>>                                    sdio_cis.o sdio_io.o sdio_irq.o \
>> -                                  quirks.o slot-gpio.o
>> +                                  slot-gpio.o
>>  mmc_core-$(CONFIG_OF)          += pwrseq.o
>>  obj-$(CONFIG_PWRSEQ_SIMPLE)    += pwrseq_simple.o
>>  obj-$(CONFIG_PWRSEQ_SD8787)    += pwrseq_sd8787.o
>> diff --git a/drivers/mmc/core/block.c b/drivers/mmc/core/block.c
>> index 985477c..ce5e2a2 100644
>> --- a/drivers/mmc/core/block.c
>> +++ b/drivers/mmc/core/block.c
>> @@ -52,6 +52,7 @@
>>  #include "host.h"
>>  #include "bus.h"
>>  #include "mmc_ops.h"
>> +#include "quirks.h"
>>  #include "sd_ops.h"
>>
>>  MODULE_ALIAS("mmc:block");
>> diff --git a/drivers/mmc/core/card.h b/drivers/mmc/core/card.h
>> index 95e8fc5..f06cd91 100644
>> --- a/drivers/mmc/core/card.h
>> +++ b/drivers/mmc/core/card.h
>> @@ -218,6 +218,4 @@ static inline int mmc_card_broken_hpi(const struct mmc_card *c)
>>         return c->quirks & MMC_QUIRK_BROKEN_HPI;
>>  }
>>
>> -void mmc_fixup_device(struct mmc_card *card, const struct mmc_fixup *table);
>> -
>>  #endif
>> diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c
>> index f1a451e..d0e6b6f 100644
>> --- a/drivers/mmc/core/mmc.c
>> +++ b/drivers/mmc/core/mmc.c
>> @@ -25,6 +25,7 @@
>>  #include "host.h"
>>  #include "bus.h"
>>  #include "mmc_ops.h"
>> +#include "quirks.h"
>>  #include "sd_ops.h"
>>
>>  #define DEFAULT_CMD6_TIMEOUT_MS        500
>> diff --git a/drivers/mmc/core/quirks.c b/drivers/mmc/core/quirks.h
>> similarity index 95%
>> rename from drivers/mmc/core/quirks.c
>> rename to drivers/mmc/core/quirks.h
>> index bf25a9c..dee83e7 100644
>> --- a/drivers/mmc/core/quirks.c
>> +++ b/drivers/mmc/core/quirks.h
>> @@ -53,7 +53,8 @@
>>         END_FIXUP
>>  };
>>
>> -void mmc_fixup_device(struct mmc_card *card, const struct mmc_fixup *table)
>> +static void mmc_fixup_device(struct mmc_card *card,
>> +                            const struct mmc_fixup *table)
>
> This should be "static inline void".

I will add this.

>
>
>>  {
>>         const struct mmc_fixup *f;
>>         u64 rev = cid_rev_card(card);
>> @@ -82,4 +83,3 @@ void mmc_fixup_device(struct mmc_card *card, const struct mmc_fixup *table)
>>                 }
>>         }
>>  }
>> -EXPORT_SYMBOL(mmc_fixup_device);
>
> Because you turn this into a header file, I think you should try to
> compile that header standalone (create a local c-file, include the
> quirks.h and compile it). Make sure you get no errors/warnings.
>

Ahh, I have done that!:)

> Moreover, please go over a check what files that really needs to be
> included from the new quirk.h, certainly some isn't needed but some
> other are. The above trick for building the header file standalone,
> helps to verify these changes.

Ditto.

BTW, I forgto to move the INAND quirk out of block.c, so I will
respin v2.

>
>
>> diff --git a/drivers/mmc/core/sdio.c b/drivers/mmc/core/sdio.c
>> index a64a870..f092a55 100644
>> --- a/drivers/mmc/core/sdio.c
>> +++ b/drivers/mmc/core/sdio.c
>> @@ -23,6 +23,7 @@
>>  #include "card.h"
>>  #include "host.h"
>>  #include "bus.h"
>> +#include "quirks.h"
>>  #include "sd.h"
>>  #include "sdio_bus.h"
>>  #include "mmc_ops.h"
>> --
>> 1.9.1
>>
>>
>
> Kind regards
> Uffe
> --
> To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
> the body of a message to majordomo@vger.kernel.org
> 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 majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/mmc/core/Makefile b/drivers/mmc/core/Makefile
index 0f81464..7e3ed1a 100644
--- a/drivers/mmc/core/Makefile
+++ b/drivers/mmc/core/Makefile
@@ -7,7 +7,7 @@  mmc_core-y			:= core.o bus.o host.o \
 				   mmc.o mmc_ops.o sd.o sd_ops.o \
 				   sdio.o sdio_ops.o sdio_bus.o \
 				   sdio_cis.o sdio_io.o sdio_irq.o \
-				   quirks.o slot-gpio.o
+				   slot-gpio.o
 mmc_core-$(CONFIG_OF)		+= pwrseq.o
 obj-$(CONFIG_PWRSEQ_SIMPLE)	+= pwrseq_simple.o
 obj-$(CONFIG_PWRSEQ_SD8787)	+= pwrseq_sd8787.o
diff --git a/drivers/mmc/core/block.c b/drivers/mmc/core/block.c
index 985477c..ce5e2a2 100644
--- a/drivers/mmc/core/block.c
+++ b/drivers/mmc/core/block.c
@@ -52,6 +52,7 @@ 
 #include "host.h"
 #include "bus.h"
 #include "mmc_ops.h"
+#include "quirks.h"
 #include "sd_ops.h"
 
 MODULE_ALIAS("mmc:block");
diff --git a/drivers/mmc/core/card.h b/drivers/mmc/core/card.h
index 95e8fc5..f06cd91 100644
--- a/drivers/mmc/core/card.h
+++ b/drivers/mmc/core/card.h
@@ -218,6 +218,4 @@  static inline int mmc_card_broken_hpi(const struct mmc_card *c)
 	return c->quirks & MMC_QUIRK_BROKEN_HPI;
 }
 
-void mmc_fixup_device(struct mmc_card *card, const struct mmc_fixup *table);
-
 #endif
diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c
index f1a451e..d0e6b6f 100644
--- a/drivers/mmc/core/mmc.c
+++ b/drivers/mmc/core/mmc.c
@@ -25,6 +25,7 @@ 
 #include "host.h"
 #include "bus.h"
 #include "mmc_ops.h"
+#include "quirks.h"
 #include "sd_ops.h"
 
 #define DEFAULT_CMD6_TIMEOUT_MS	500
diff --git a/drivers/mmc/core/quirks.c b/drivers/mmc/core/quirks.h
similarity index 95%
rename from drivers/mmc/core/quirks.c
rename to drivers/mmc/core/quirks.h
index bf25a9c..dee83e7 100644
--- a/drivers/mmc/core/quirks.c
+++ b/drivers/mmc/core/quirks.h
@@ -53,7 +53,8 @@ 
 	END_FIXUP
 };
 
-void mmc_fixup_device(struct mmc_card *card, const struct mmc_fixup *table)
+static void mmc_fixup_device(struct mmc_card *card,
+			     const struct mmc_fixup *table)
 {
 	const struct mmc_fixup *f;
 	u64 rev = cid_rev_card(card);
@@ -82,4 +83,3 @@  void mmc_fixup_device(struct mmc_card *card, const struct mmc_fixup *table)
 		}
 	}
 }
-EXPORT_SYMBOL(mmc_fixup_device);
diff --git a/drivers/mmc/core/sdio.c b/drivers/mmc/core/sdio.c
index a64a870..f092a55 100644
--- a/drivers/mmc/core/sdio.c
+++ b/drivers/mmc/core/sdio.c
@@ -23,6 +23,7 @@ 
 #include "card.h"
 #include "host.h"
 #include "bus.h"
+#include "quirks.h"
 #include "sd.h"
 #include "sdio_bus.h"
 #include "mmc_ops.h"