ATH10K Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Kalle Valo <kvalo@qca.qualcomm.com>
To: Michal Kazior <michal.kazior@tieto.com>
Cc: ath10k@lists.infradead.org
Subject: Re: [PATCH v2 3/3] ath10k: make target endianess more explicit
Date: Wed, 27 Aug 2014 10:28:05 +0300	[thread overview]
Message-ID: <874mwyxugq.fsf@kamboji.qca.qualcomm.com> (raw)
In-Reply-To: <1408961963-3682-4-git-send-email-michal.kazior@tieto.com> (Michal Kazior's message of "Mon, 25 Aug 2014 12:19:23 +0200")

Michal Kazior <michal.kazior@tieto.com> writes:

> Some copy engine structures are target specific
> and are uploaded to the device during
> init/configuration.
>
> This also cleans up a bit diag_mem_read/write
> implicit byteswap mess leaving only
> diag_access_read/write with an implicit endianess
> byteswap.
>
> Signed-off-by: Michal Kazior <michal.kazior@tieto.com>

[...]

>  /* Write 4B data to Target memory or register */
>  static int ath10k_pci_diag_write_access(struct ath10k *ar, u32 address,
>  					u32 data)
>  {
>  	/* Assume range doesn't cross this boundary */
>  	if (address >= DRAM_BASE_ADDRESS)
> -		return ath10k_pci_diag_write_mem(ar, address, &data,
> -						 sizeof(u32));
> +		return ath10k_pci_diag_write32(ar, address, data);

Nothing wrong with your patch, but I really despise functions with split
personality like this one. The caller should know which area it's
writing to. And we have similar stuff in ath10k_pci_diag_read_mem() as
well:

	/*
	 * This code cannot handle reads to non-memory space. Redirect to the
	 * register read fn but preserve the multi word read capability of
	 * this fn
	 */
	if (address < DRAM_BASE_ADDRESS) {
		if (!IS_ALIGNED(address, 4) ||
		    !IS_ALIGNED((unsigned long)data, 4))
			return -EIO;

		while ((nbytes >= 4) &&  ((ret = ath10k_pci_diag_read_access(
					   ar, address, (u32 *)data)) == 0)) {
			nbytes -= sizeof(u32);
			address += sizeof(u32);
			data += sizeof(u32);
		}
		return ret;
	}


Can you guess what's the idea behind this? I would prefer that we get
rid of all the ugly _access() functions in pci.c.

-- 
Kalle Valo



_______________________________________________
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k

  parent reply	other threads:[~2014-08-27  7:28 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-25 10:19 [PATCH v2 0/3] ath10k: ce fixes 2014-08-08 Michal Kazior
2014-08-25 10:19 ` [PATCH v2 1/3] ath10k: move pci init structures Michal Kazior
2014-08-25 10:19 ` [PATCH v2 2/3] ath10k: dont duplicate service-pipe mapping Michal Kazior
2014-08-25 10:19 ` [PATCH v2 3/3] ath10k: make target endianess more explicit Michal Kazior
2014-08-27  7:26   ` Kalle Valo
2014-08-27  8:15     ` Michal Kazior
2014-08-27  7:28   ` Kalle Valo [this message]
2014-08-27  8:18     ` Michal Kazior
2014-08-27 12:14 ` [PATCH v2 0/3] ath10k: ce fixes 2014-08-08 Kalle Valo

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=874mwyxugq.fsf@kamboji.qca.qualcomm.com \
    --to=kvalo@qca.qualcomm.com \
    --cc=ath10k@lists.infradead.org \
    --cc=michal.kazior@tieto.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