devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd@arndb.de>
To: Loc Ho <lho@apm.com>
Cc: devicetree@vger.kernel.org, Suman Tripathi <stripathi@apm.com>,
	linux-scsi@vger.kernel.org, linux-ide@vger.kernel.org,
	jcm@redhat.com, tj@kernel.org, olof@lixom.net,
	Tuan Phan <tphan@apm.com>,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH v3 3/4] ata: Add APM X-Gene SoC SATA host controller driver
Date: Fri, 15 Nov 2013 14:48:15 +0100	[thread overview]
Message-ID: <201311151448.16279.arnd@arndb.de> (raw)
In-Reply-To: <1384465153-29902-4-git-send-email-lho@apm.com>

On Thursday 14 November 2013, Loc Ho wrote:
>  
> +config SATA_XGENE
> +	tristate "APM X-Gene 6.0Gbps SATA host controller support"
> +	depends on SATA_AHCI_PLATFORM
> +	default y if ARM64
> +	select SATA_XGENE_PHY

I don't think the "default y" is appropriate here, since there are going to
be lots of ARM64 platforms in the long run that don't have this. Also,
there is a trend towards using CONFIG_COMPILE_TEST to limit the
visibility.

I'd suggest something like

config SATA_XGENE
	tristate "APM X-Gene 6.0Gbps SATA host controller support"
	depends on ARM64 || COMPILE_TEST
	...

> +/* Enable for dumping CSR read/write access */
> +#undef XGENE_DBG_CSR

This should be removed now as well, along with the debug macro you already removed.

> +
> +/* Temporary function until the PHY parameter API */
> +extern void xgene_ahci_phy_set_pq(struct phy *phy, int chan, int data);
> +extern void xgene_ahci_phy_set_spd(struct phy *phy, int chan, int gen);

Ah, that should have been mentioned in the changeset text. Do you think you
can remove these for the final version?

> +static void xgene_rd(void *addr, u32 *val)
> +{
> +	*val = readl(addr);
> +#if defined(XGENE_DBG_CSR)
> +	printk(KERN_DEBUG "SATAPHY CSR RD: 0x%p value: 0x%08x\n", addr, *val);
> +#endif
> +}

The interface you are looking for is pr_debug() or dev_dbg(), which get
built-in only if the DEBUG macro is set.

In a lot of cases, it's actually best to remove debug output like this from
the driver once you have it working  -- whoever is debugging problems in 
the driver next might need completely different debugging information or
can add them back easily if needed.

It's your choice if you want to use pr_debug() or remove that output
entirely. If you remove it, best remove the helper functions entirely
and use readl/writel directly.

> +/* Flush the IOB to ensure all SATA controller writes completed before
> +   servicing the completed command. */
> +static int xgene_ahci_iob_flush(struct xgene_ahci_context *ctx)
> +{
> +	if (ctx->ahbc_io_base == NULL) {
> +		void *ahbc_base;
> +		u32 val;
> +
> +		/* The AHBC address is fixed in X-Gene */
> +		ahbc_base = devm_ioremap(ctx->dev, 0x1F2A0000, 0x80000);
> +		if (!ahbc_base) {
> +			dev_err(ctx->dev, "can't map AHBC resource\n");
> +			return -ENODEV;
> +		}

I had an important comment about the misuse of hardcoded I/O addresses
here. Please never just post a new version with the same issue. In general,
your options are:

* rewrite the code in a more appropriate way
* reply to the comment, arguing why you think your code is correct
* ask for clarification if you don't know how to improve the code
* mark the code as TODO and mention in the patch description why you
  are still working on this and that the current version should not
  be seen as final.

If you don't do any of these, reviewers will get annoyed because you
are wasting their time.
> +
> +static int xgene_ahci_get_u32_param(struct platform_device *pdev,
> +				    const char *of_name, char *acpi_name,
> +				    u32 *param)
> +{
> +#ifdef CONFIG_ACPI
> +	if (efi_enabled(EFI_BOOT)) {
> +		unsigned long long value;
> +		acpi_status status;
> +		if (acpi_name == NULL)
> +			return -ENODEV;
> +		status = acpi_evaluate_integer(ACPI_HANDLE(&pdev->dev),
> +					       acpi_name, NULL, &value);
> +		if (ACPI_FAILURE(status))
> +			return -ENODEV;
> +		*param = value;
> +		return 0;
> +	}
> +#endif

There are more previous comments that you have not addressed yet.

> diff --git a/drivers/ata/sata_xgene.h b/drivers/ata/sata_xgene.h
> new file mode 100644
> index 0000000..51e73f6
> --- /dev/null
> +++ b/drivers/ata/sata_xgene.h

This file should probably just be folded into the driver, since it contains no
interfaces between  modules, just internal definitions.

	Arnd

  parent reply	other threads:[~2013-11-15 13:48 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-14 21:39 [PATCH v3 0/4] ata: Add APM X-Gene SoC SATA host controller support Loc Ho
2013-11-14 21:39 ` [PATCH v3 1/4] ata: Export required functions by APM X-Gene SATA driver Loc Ho
2013-11-14 21:39   ` [PATCH v3 2/4] Documentation: Add documentation for APM X-Gene SATA controllor DTS binding Loc Ho
2013-11-14 21:39     ` [PATCH v3 3/4] ata: Add APM X-Gene SoC SATA host controller driver Loc Ho
2013-11-14 21:39       ` [PATCH v4 4/4] arm64: Add APM X-Gene SoC SATA DTS entries Loc Ho
2013-11-15 13:48       ` Arnd Bergmann [this message]
2013-11-16  6:36         ` [PATCH v3 3/4] ata: Add APM X-Gene SoC SATA host controller driver Loc Ho
2013-11-19 21:22           ` Loc Ho
2013-11-26 10:11             ` Kishon Vijay Abraham I
2013-11-26 16:41               ` Loc Ho
2013-11-27  5:52                 ` Kishon Vijay Abraham I
2013-11-27  5:58                   ` Loc Ho
2013-11-21 13:20           ` Arnd Bergmann
2013-11-21 19:01             ` Loc Ho
2013-11-15 13:28     ` [PATCH v3 2/4] Documentation: Add documentation for APM X-Gene SATA controllor DTS binding Arnd Bergmann

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=201311151448.16279.arnd@arndb.de \
    --to=arnd@arndb.de \
    --cc=devicetree@vger.kernel.org \
    --cc=jcm@redhat.com \
    --cc=lho@apm.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-ide@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=olof@lixom.net \
    --cc=stripathi@apm.com \
    --cc=tj@kernel.org \
    --cc=tphan@apm.com \
    /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;
as well as URLs for NNTP newsgroup(s).