mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Adrian Hunter <adrian.hunter@intel.com>
To: Andrew Jeffery <andrew@aj.id.au>, linux-mmc@vger.kernel.org
Cc: ulf.hansson@linaro.org, robh+dt@kernel.org, joel@jms.id.au,
	linux-kernel@vger.kernel.org, devicetree@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-aspeed@lists.ozlabs.org, ryan_chen@aspeedtech.com
Subject: Re: [PATCH v6 4/6] mmc: sdhci-of-aspeed: Add KUnit tests for phase calculations
Date: Tue, 5 Jan 2021 15:47:00 +0200	[thread overview]
Message-ID: <ff588027-0fbb-100e-05a9-4a804662d838@intel.com> (raw)
In-Reply-To: <20201218035338.1130849-5-andrew@aj.id.au>

On 18/12/20 5:53 am, Andrew Jeffery wrote:
> Converting degrees of phase to logic delays is irritating to test on
> hardware, so lets exercise the function using KUnit.
> 
> Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
> ---
>  drivers/mmc/host/Kconfig                |  14 ++++
>  drivers/mmc/host/Makefile               |   1 +
>  drivers/mmc/host/sdhci-of-aspeed-test.c | 100 ++++++++++++++++++++++++
>  3 files changed, 115 insertions(+)
>  create mode 100644 drivers/mmc/host/sdhci-of-aspeed-test.c
> 
> diff --git a/drivers/mmc/host/Kconfig b/drivers/mmc/host/Kconfig
> index 596f32637315..d6f00d1d6251 100644
> --- a/drivers/mmc/host/Kconfig
> +++ b/drivers/mmc/host/Kconfig
> @@ -168,6 +168,20 @@ config MMC_SDHCI_OF_ASPEED
>  
>  	  If unsure, say N.
>  
> +config MMC_SDHCI_OF_ASPEED_TEST
> +	bool "Tests for the ASPEED SDHCI driver"
> +	depends on MMC_SDHCI_OF_ASPEED && KUNIT=y
> +	help
> +	  Enable KUnit tests for the ASPEED SDHCI driver. Select this
> +	  option only if you will boot the kernel for the purpose of running
> +	  unit tests (e.g. under UML or qemu).
> +
> +	  The KUnit tests generally exercise parts of the driver that do not
> +	  directly touch the hardware, for example, the phase correction
> +	  calculations.
> +
> +	  If unsure, say N.
> +
>  config MMC_SDHCI_OF_AT91
>  	tristate "SDHCI OF support for the Atmel SDMMC controller"
>  	depends on MMC_SDHCI_PLTFM
> diff --git a/drivers/mmc/host/Makefile b/drivers/mmc/host/Makefile
> index 451c25fc2c69..3ee59d5802cf 100644
> --- a/drivers/mmc/host/Makefile
> +++ b/drivers/mmc/host/Makefile
> @@ -90,6 +90,7 @@ obj-$(CONFIG_MMC_SDHCI_DOVE)		+= sdhci-dove.o
>  obj-$(CONFIG_MMC_SDHCI_TEGRA)		+= sdhci-tegra.o
>  obj-$(CONFIG_MMC_SDHCI_OF_ARASAN)	+= sdhci-of-arasan.o
>  obj-$(CONFIG_MMC_SDHCI_OF_ASPEED)	+= sdhci-of-aspeed.o
> +obj-$(CONFIG_MMC_SDHCI_OF_ASPEED_TEST)	+= sdhci-of-aspeed-test.o
>  obj-$(CONFIG_MMC_SDHCI_OF_AT91)		+= sdhci-of-at91.o
>  obj-$(CONFIG_MMC_SDHCI_OF_ESDHC)	+= sdhci-of-esdhc.o
>  obj-$(CONFIG_MMC_SDHCI_OF_HLWD)		+= sdhci-of-hlwd.o
> diff --git a/drivers/mmc/host/sdhci-of-aspeed-test.c b/drivers/mmc/host/sdhci-of-aspeed-test.c
> new file mode 100644
> index 000000000000..fb79b278fb81
> --- /dev/null
> +++ b/drivers/mmc/host/sdhci-of-aspeed-test.c
> @@ -0,0 +1,100 @@
> +// SPDX-License-Identifier: GPL-2.0-or-later
> +/* Copyright (C) 2020 IBM Corp. */
> +
> +#include <kunit/test.h>
> +
> +#include "sdhci-of-aspeed.c"

I am not sure including like that is advisable.  Did you consider instead
doing it the other way around i.e. adding an include to the bottom of
sdhci-of-aspeed.c?

  reply	other threads:[~2021-01-05 13:48 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-18  3:53 [PATCH v6 0/6] mmc: sdhci-of-aspeed: Expose phase delay tuning Andrew Jeffery
2020-12-18  3:53 ` [PATCH v6 1/6] mmc: core: Add helper for parsing clock phase properties Andrew Jeffery
2020-12-18  3:53 ` [PATCH v6 2/6] mmc: sdhci-of-aspeed: Expose clock phase controls Andrew Jeffery
2020-12-18  3:53 ` [PATCH v6 3/6] mmc: sdhci-of-aspeed: Add AST2600 bus clock support Andrew Jeffery
2020-12-18  3:53 ` [PATCH v6 4/6] mmc: sdhci-of-aspeed: Add KUnit tests for phase calculations Andrew Jeffery
2021-01-05 13:47   ` Adrian Hunter [this message]
2021-01-11  0:02     ` Andrew Jeffery
2020-12-18  3:53 ` [PATCH v6 5/6] MAINTAINERS: Add entry for the ASPEED SD/MMC driver Andrew Jeffery
2020-12-18  3:53 ` [PATCH v6 6/6] ARM: dts: rainier: Add eMMC clock phase compensation Andrew Jeffery

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ff588027-0fbb-100e-05a9-4a804662d838@intel.com \
    --to=adrian.hunter@intel.com \
    --cc=andrew@aj.id.au \
    --cc=devicetree@vger.kernel.org \
    --cc=joel@jms.id.au \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-aspeed@lists.ozlabs.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=robh+dt@kernel.org \
    --cc=ryan_chen@aspeedtech.com \
    --cc=ulf.hansson@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®