mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Francois Romieu <romieu@fr.zoreil.com>
To: Chunhao Lin <hau@realtek.com>
Cc: netdev@vger.kernel.org, nic_swsd@realtek.com,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH net-next] r8169: add module param for control of ASPM disable
Date: Fri, 2 Feb 2018 00:26:52 +0100	[thread overview]
Message-ID: <20180201232652.GA19190@electric-eye.fr.zoreil.com> (raw)
In-Reply-To: <1517500663-24052-1-git-send-email-hau@realtek.com>

Chunhao Lin <hau@realtek.com> :
[...]
> @@ -5878,6 +5881,20 @@ static void rtl_pcie_state_l2l3_enable(struct rtl8169_private *tp, bool enable)
>  	RTL_W8(Config3, data);
>  }
>  
> +static void rtl_hw_internal_aspm_clkreq_enable(struct rtl8169_private *tp,
> +				bool enable)
> +{
> +	void __iomem *ioaddr = tp->mmio_addr;
> +
> +	if (enable) {
> +		RTL_W8(Config2, RTL_R8(Config2) | ClkReqEn);
> +		RTL_W8(Config5, RTL_R8(Config5) | ASPM_en);
> +	} else {
> +		RTL_W8(Config2, RTL_R8(Config2) & ~ClkReqEn);
> +		RTL_W8(Config5, RTL_R8(Config5) & ~ASPM_en);
> +	}
> +}

s/enable(..., false)/disable()/

static void rtl_hw_internal_aspm_clkreq_enable(truct rtl8169_private *tp)
{
	void __iomem *ioaddr = tp->mmio_addr;

	RTL_W8(Config2, RTL_R8(Config2) | ClkReqEn);
	RTL_W8(Config5, RTL_R8(Config5) | ASPM_en);
}

static void rtl_hw_internal_aspm_clkreq_disable(truct rtl8169_private *tp)
{
	void __iomem *ioaddr = tp->mmio_addr;

	RTL_W8(Config2, RTL_R8(Config2) & ~ClkReqEn);
	RTL_W8(Config5, RTL_R8(Config5) & ~ASPM_en);
}

If you really want to factor something out, you may use helpers that set
or clear bits according to the 3-uple (tp, register, bits) but
foo_enable(..., false) is pointlessly convoluted.

-- 
Ueimor

  reply	other threads:[~2018-02-01 23:27 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-01 15:57 Chunhao Lin
2018-02-01 23:26 ` Francois Romieu [this message]
2018-02-01 23:29   ` Francois Romieu
2018-02-02 12:52   ` Hau

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=20180201232652.GA19190@electric-eye.fr.zoreil.com \
    --to=romieu@fr.zoreil.com \
    --cc=hau@realtek.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=nic_swsd@realtek.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

all inboxes | Powered by JetHome®