All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kalle Valo <kvalo@codeaurora.org>
To: Pablo Greco <pgreco@centosproject.org>
Cc: Ryder Lee <ryder.lee@mediatek.com>,
	netdev@vger.kernel.org, linux-wireless@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	Matthias Brugger <matthias.bgg@gmail.com>,
	linux-mediatek@lists.infradead.org, Roy Luo <royluo@google.com>,
	Lorenzo Bianconi <lorenzo.bianconi83@gmail.com>,
	"David S. Miller" <davem@davemloft.net>,
	linux-arm-kernel@lists.infradead.org,
	Felix Fietkau <nbd@nbd.name>
Subject: Re: [PATCH v1] mt76: mt7615: Fix build with older compilers
Date: Mon, 2 Dec 2019 09:25:05 +0000	[thread overview]
Message-ID: <0101016ec5ed7c1c-0d86f585-372a-4b20-af6e-5b59e732b70c-000000@us-west-2.amazonses.com> (raw)
In-Reply-To: <20191201181716.61892-1-pgreco@centosproject.org> (Pablo Greco's message of "Sun, 1 Dec 2019 15:17:10 -0300")

Pablo Greco <pgreco@centosproject.org> writes:

> Some compilers (tested with 4.8.5 from CentOS 7) fail properly process
> FIELD_GET inside an inline function, which ends up in a BUILD_BUG_ON.
> Convert inline function to a macro.
>
> Fixes commit bf92e7685100 ("mt76: mt7615: add support for per-chain
> signal strength reporting")
> Reported in https://lkml.org/lkml/2019/9/21/146
>
> Reported-by: kbuild test robot <lkp@intel.com>
> Signed-off-by: Pablo Greco <pgreco@centosproject.org>
> ---
>  drivers/net/wireless/mediatek/mt76/mt7615/mac.c | 5 +----
>  1 file changed, 1 insertion(+), 4 deletions(-)
>
> diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/mac.c b/drivers/net/wireless/mediatek/mt76/mt7615/mac.c
> index c77adc5d2552..77e395ca2c6a 100644
> --- a/drivers/net/wireless/mediatek/mt76/mt7615/mac.c
> +++ b/drivers/net/wireless/mediatek/mt76/mt7615/mac.c
> @@ -13,10 +13,7 @@
>  #include "../dma.h"
>  #include "mac.h"
>  
> -static inline s8 to_rssi(u32 field, u32 rxv)
> -{
> -	return (FIELD_GET(field, rxv) - 220) / 2;
> -}
> +#define to_rssi(field, rxv)		((FIELD_GET(field, rxv) - 220) / 2)

What about u32_get_bits() instead of FIELD_GET(), would that work? I
guess chances for that is slim, but it's always a shame to convert a
function to a macro so we should try other methods first.

Or even better if we could fix FIELD_GET() to work with older compilers.

-- 
https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches

_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

WARNING: multiple messages have this Message-ID (diff)
From: Kalle Valo <kvalo@codeaurora.org>
To: Pablo Greco <pgreco@centosproject.org>
Cc: Ryder Lee <ryder.lee@mediatek.com>,
	netdev@vger.kernel.org, linux-wireless@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	Matthias Brugger <matthias.bgg@gmail.com>,
	linux-mediatek@lists.infradead.org, Roy Luo <royluo@google.com>,
	Lorenzo Bianconi <lorenzo.bianconi83@gmail.com>,
	"David S. Miller" <davem@davemloft.net>,
	linux-arm-kernel@lists.infradead.org,
	Felix Fietkau <nbd@nbd.name>
Subject: Re: [PATCH v1] mt76: mt7615: Fix build with older compilers
Date: Mon, 2 Dec 2019 09:25:05 +0000	[thread overview]
Message-ID: <0101016ec5ed7c1c-0d86f585-372a-4b20-af6e-5b59e732b70c-000000@us-west-2.amazonses.com> (raw)
In-Reply-To: <20191201181716.61892-1-pgreco@centosproject.org> (Pablo Greco's message of "Sun, 1 Dec 2019 15:17:10 -0300")

Pablo Greco <pgreco@centosproject.org> writes:

> Some compilers (tested with 4.8.5 from CentOS 7) fail properly process
> FIELD_GET inside an inline function, which ends up in a BUILD_BUG_ON.
> Convert inline function to a macro.
>
> Fixes commit bf92e7685100 ("mt76: mt7615: add support for per-chain
> signal strength reporting")
> Reported in https://lkml.org/lkml/2019/9/21/146
>
> Reported-by: kbuild test robot <lkp@intel.com>
> Signed-off-by: Pablo Greco <pgreco@centosproject.org>
> ---
>  drivers/net/wireless/mediatek/mt76/mt7615/mac.c | 5 +----
>  1 file changed, 1 insertion(+), 4 deletions(-)
>
> diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/mac.c b/drivers/net/wireless/mediatek/mt76/mt7615/mac.c
> index c77adc5d2552..77e395ca2c6a 100644
> --- a/drivers/net/wireless/mediatek/mt76/mt7615/mac.c
> +++ b/drivers/net/wireless/mediatek/mt76/mt7615/mac.c
> @@ -13,10 +13,7 @@
>  #include "../dma.h"
>  #include "mac.h"
>  
> -static inline s8 to_rssi(u32 field, u32 rxv)
> -{
> -	return (FIELD_GET(field, rxv) - 220) / 2;
> -}
> +#define to_rssi(field, rxv)		((FIELD_GET(field, rxv) - 220) / 2)

What about u32_get_bits() instead of FIELD_GET(), would that work? I
guess chances for that is slim, but it's always a shame to convert a
function to a macro so we should try other methods first.

Or even better if we could fix FIELD_GET() to work with older compilers.

-- 
https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  parent reply	other threads:[~2019-12-02  9:25 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-01 18:17 [PATCH v1] mt76: mt7615: Fix build with older compilers Pablo Greco
2019-12-01 18:17 ` Pablo Greco
2019-12-01 18:17 ` Pablo Greco
2019-12-02  9:18 ` Sergei Shtylyov
2019-12-02  9:18   ` Sergei Shtylyov
2019-12-02  9:18   ` Sergei Shtylyov
2019-12-02 10:30   ` Pablo Sebastián Greco
2019-12-02 10:30     ` Pablo Sebastián Greco
2019-12-02 10:30     ` Pablo Sebastián Greco
2019-12-02  9:25 ` Kalle Valo [this message]
2019-12-02  9:25   ` Kalle Valo
2019-12-02  9:25 ` Kalle Valo
     [not found] ` <0101016ec5ed7d91-eac61501-1e4a-42f1-881d-cc2c02eb8372-000000@us-west-2.amazonses.com>
2019-12-02 10:42   ` Pablo Sebastián Greco
2019-12-02 10:42     ` Pablo Sebastián Greco
2019-12-02 10:42     ` Pablo Sebastián Greco

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=0101016ec5ed7c1c-0d86f585-372a-4b20-af6e-5b59e732b70c-000000@us-west-2.amazonses.com \
    --to=kvalo@codeaurora.org \
    --cc=davem@davemloft.net \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=lorenzo.bianconi83@gmail.com \
    --cc=matthias.bgg@gmail.com \
    --cc=nbd@nbd.name \
    --cc=netdev@vger.kernel.org \
    --cc=pgreco@centosproject.org \
    --cc=royluo@google.com \
    --cc=ryder.lee@mediatek.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.