From: Thierry Reding <thierry.reding@gmail.com>
To: Preetham Chandru Ramchandra <pchandru@nvidia.com>
Cc: tj@kernel.org, cyndis@kapsi.fi, robh+dt@kernel.org,
mark.rutland@arm.com, devicetree@vger.kernel.org,
preetham260@gmail.com, linux-tegra@vger.kernel.org,
linux-ide@vger.kernel.org, vbyravarasu@nvidia.com,
pkunapuli@nvidia.com
Subject: Re: [PATCH V7 3/7] ata: ahci_tegra: Update initialization sequence
Date: Mon, 19 Feb 2018 15:41:25 +0100 [thread overview]
Message-ID: <20180219144125.GF11455@ulmo> (raw)
In-Reply-To: <1518456406-21564-4-git-send-email-pchandru@nvidia.com>
[-- Attachment #1: Type: text/plain, Size: 3511 bytes --]
On Mon, Feb 12, 2018 at 10:56:42PM +0530, Preetham Chandru Ramchandra wrote:
> From: Preetham Ramchandra <pchandru@nvidia.com>
>
> Update the controller initialization sequence and move
> t124 specifics to tegra124_ahci_init.
>
> Signed-off-by: Preetham Chandru R <pchandru@nvidia.com>
> ---
> v7:
> * moveed tegra124_ahci_soc_data definition to be
> just above the of_device_id table.
> ---
> drivers/ata/ahci_tegra.c | 288 ++++++++++++++++++++++++++++++++++++-----------
> 1 file changed, 223 insertions(+), 65 deletions(-)
>
> diff --git a/drivers/ata/ahci_tegra.c b/drivers/ata/ahci_tegra.c
> index 3a62eb246d80..7ffe8a97447a 100644
> --- a/drivers/ata/ahci_tegra.c
> +++ b/drivers/ata/ahci_tegra.c
[...]
> @@ -99,6 +159,14 @@ static const struct sata_pad_calibration tegra124_pad_calibration[] = {
> {0x14, 0x0e, 0x1a, 0x0e},
> };
>
> +struct tegra_ahci_ops {
> + int (*init)(struct ahci_host_priv *hpriv);
> +};
> +
> +struct tegra_ahci_soc {
> + struct tegra_ahci_ops ops;
> +};
> +
> struct tegra_ahci_priv {
> struct platform_device *pdev;
> void __iomem *sata_regs;
> @@ -108,8 +176,53 @@ struct tegra_ahci_priv {
> /* Needs special handling, cannot use ahci_platform */
> struct clk *sata_clk;
> struct regulator_bulk_data supplies[5];
> + struct tegra_ahci_soc *soc_data;
This should be const. I also think the _data suffix is unnecessary.
> @@ -145,7 +258,6 @@ static int tegra_ahci_power_on(struct ahci_host_priv *hpriv)
>
> disable_regulators:
> regulator_bulk_disable(ARRAY_SIZE(tegra->supplies), tegra->supplies);
> -
> return ret;
> }
Unneeded whitespace change.
> @@ -179,78 +290,114 @@ static int tegra_ahci_controller_init(struct ahci_host_priv *hpriv)
> return ret;
> }
>
> + /*
> + * Program the following SATA IPFS registers
> + * to allow SW accesses to SATA's MMIO register range.
> + */
You can also use the full width of a line for comments. No need to wrap
at arbitrary points.
> @@ -285,8 +432,17 @@ static const struct ata_port_info ahci_tegra_port_info = {
> .port_ops = &ahci_tegra_port_ops,
> };
>
> +static const struct tegra_ahci_soc tegra124_ahci_soc_data = {
> + .ops = {
> + .init = tegra124_ahci_init,
> + },
> +};
> +
Again, I don't think there's a need for _data. Also, you've made this
const, so tegra->soc(_data) should also be const. One rule of thumb is
that if you have const in one place, then you need to make it const
everywhere.
> static const struct of_device_id tegra_ahci_of_match[] = {
> - { .compatible = "nvidia,tegra124-ahci" },
> + {
> + .compatible = "nvidia,tegra124-ahci",
> + .data = &tegra124_ahci_soc_data
> + },
> {}
> };
of_device_id.data is const as well, which is why this compiles properly.
> MODULE_DEVICE_TABLE(of, tegra_ahci_of_match);
> @@ -313,6 +469,8 @@ static int tegra_ahci_probe(struct platform_device *pdev)
> hpriv->plat_data = tegra;
>
> tegra->pdev = pdev;
> + tegra->soc_data =
> + (struct tegra_ahci_soc *)of_device_get_match_data(&pdev->dev);
And if you make tegra->soc(_data) const, then there's no need for this
cast, you can simply assign directly:
tegra->soc = of_device_get_match_data(&pdev->dev);
void * will be automatically cast to any other pointer. The only reason
why you need the cast above is to avoid the compiler from warning about
the const qualifier being cast away.
Once const, always const.
Thierry
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
next prev parent reply other threads:[~2018-02-19 14:41 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-12 17:26 [PATCH V7 0/7] Refactor and add AHCI support for tegra210 Preetham Chandru Ramchandra
[not found] ` <1518456406-21564-1-git-send-email-pchandru-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2018-02-12 17:26 ` [PATCH V7 1/7] dt-bindings: ahci-tegra: add binding documentation Preetham Chandru Ramchandra
2018-02-19 2:46 ` Rob Herring
2018-02-19 14:14 ` Thierry Reding
2018-02-19 14:24 ` Thierry Reding
2018-02-27 12:03 ` Preetham Chandru
2018-02-27 12:02 ` Preetham Chandru
2018-02-19 14:27 ` Thierry Reding
2018-02-27 12:05 ` Preetham Chandru
2018-02-19 14:28 ` Thierry Reding
2018-02-27 12:05 ` Preetham Chandru
2018-02-12 17:26 ` [PATCH V7 2/7] arm64: tegra: Enable AHCI on Jetson TX1 Preetham Chandru Ramchandra
2018-02-19 14:31 ` Thierry Reding
2018-02-12 17:26 ` [PATCH V7 3/7] ata: ahci_tegra: Update initialization sequence Preetham Chandru Ramchandra
2018-02-19 14:41 ` Thierry Reding [this message]
2018-02-19 14:54 ` Thierry Reding
2018-02-12 17:26 ` [PATCH V7 6/7] ata: ahci_tegra: disable DIPM Preetham Chandru Ramchandra
2018-02-19 14:47 ` Thierry Reding
2018-02-12 17:26 ` [PATCH V7 7/7] ata: ahci_tegra: Add AHCI support for Tegra210 Preetham Chandru Ramchandra
2018-02-19 14:49 ` Thierry Reding
2018-02-12 17:26 ` [PATCH V7 4/7] ata: ahci_tegra: initialize regulators from soc_data Preetham Chandru Ramchandra
2018-02-19 14:42 ` Thierry Reding
2018-02-12 17:26 ` [PATCH V7 5/7] ata: ahci_tegra: disable devslp for t124 Preetham Chandru Ramchandra
2018-02-19 14:47 ` Thierry Reding
2018-02-14 13:11 ` [PATCH V7 0/7] Refactor and add AHCI support for tegra210 Mikko Perttunen
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=20180219144125.GF11455@ulmo \
--to=thierry.reding@gmail.com \
--cc=cyndis@kapsi.fi \
--cc=devicetree@vger.kernel.org \
--cc=linux-ide@vger.kernel.org \
--cc=linux-tegra@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=pchandru@nvidia.com \
--cc=pkunapuli@nvidia.com \
--cc=preetham260@gmail.com \
--cc=robh+dt@kernel.org \
--cc=tj@kernel.org \
--cc=vbyravarasu@nvidia.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).