mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Yuehaibing <yuehaibing@huawei.com>
To: Simon Horman <simon.horman@netronome.com>
Cc: <epomozov@marvell.com>, <igor.russkikh@aquantia.com>,
	<davem@davemloft.net>, <dmitry.bezrukov@aquantia.com>,
	<sergey.samoilenko@aquantia.com>, <netdev@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH net-next] net: aquantia: Fix build error wihtout CONFIG_PTP_1588_CLOCK
Date: Sat, 26 Oct 2019 16:57:44 +0800	[thread overview]
Message-ID: <4edcf4c4-b8fc-00a1-5f13-6c41a27eb4a5@huawei.com> (raw)
In-Reply-To: <20191026080929.GD31244@netronome.com>

On 2019/10/26 16:09, Simon Horman wrote:
> On Fri, Oct 25, 2019 at 09:37:26PM +0800, YueHaibing wrote:
>> If PTP_1588_CLOCK is n, building fails:
>>
>> drivers/net/ethernet/aquantia/atlantic/aq_ptp.c: In function aq_ptp_adjfine:
>> drivers/net/ethernet/aquantia/atlantic/aq_ptp.c:279:11:
>>  error: implicit declaration of function scaled_ppm_to_ppb [-Werror=implicit-function-declaration]
>>            scaled_ppm_to_ppb(scaled_ppm));
>>
>> Just cp scaled_ppm_to_ppb() from ptp_clock.c to fix this.
>>
>> Fixes: 910479a9f793 ("net: aquantia: add basic ptp_clock callbacks")
>> Signed-off-by: YueHaibing <yuehaibing@huawei.com>
> 
> Hi YueHaibing,
> 
> thanks for your patch.
> 
> What is the motivation for not using the existing copy of this function?

I'm not sure if PTP_1588_CLOCK is needed at this config,
using the existing function need to PTP_1588_CLOCK is selected.

> 
>> ---
>>  drivers/net/ethernet/aquantia/atlantic/aq_ptp.c | 20 ++++++++++++++++++++
>>  1 file changed, 20 insertions(+)
>>
>> diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_ptp.c b/drivers/net/ethernet/aquantia/atlantic/aq_ptp.c
>> index 3ec0841..80c001d 100644
>> --- a/drivers/net/ethernet/aquantia/atlantic/aq_ptp.c
>> +++ b/drivers/net/ethernet/aquantia/atlantic/aq_ptp.c
>> @@ -262,6 +262,26 @@ static void aq_ptp_tx_timeout_check(struct aq_ptp_s *aq_ptp)
>>  	}
>>  }
>>  
>> +static s32 scaled_ppm_to_ppb(long ppm)
>> +{
>> +	/*
>> +	 * The 'freq' field in the 'struct timex' is in parts per
>> +	 * million, but with a 16 bit binary fractional field.
>> +	 *
>> +	 * We want to calculate
>> +	 *
>> +	 *    ppb = scaled_ppm * 1000 / 2^16
>> +	 *
>> +	 * which simplifies to
>> +	 *
>> +	 *    ppb = scaled_ppm * 125 / 2^13
>> +	 */
>> +	s64 ppb = 1 + ppm;
>> +	ppb *= 125;
>> +	ppb >>= 13;
>> +	return (s32) ppb;
>> +}
>> +
>>  /* aq_ptp_adjfine
>>   * @ptp: the ptp clock structure
>>   * @ppb: parts per billion adjustment from base
>> -- 
>> 2.7.4
>>
>>
> 
> .
> 


  reply	other threads:[~2019-10-26  8:57 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-25 13:37 YueHaibing
2019-10-25 15:06 ` [EXT] " Igor Russkikh
2019-10-26  8:09 ` Simon Horman
2019-10-26  8:57   ` Yuehaibing [this message]
2019-10-26 11:09     ` [EXT] " Igor Russkikh
2019-10-28  7:49       ` Yuehaibing

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=4edcf4c4-b8fc-00a1-5f13-6c41a27eb4a5@huawei.com \
    --to=yuehaibing@huawei.com \
    --cc=davem@davemloft.net \
    --cc=dmitry.bezrukov@aquantia.com \
    --cc=epomozov@marvell.com \
    --cc=igor.russkikh@aquantia.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=sergey.samoilenko@aquantia.com \
    --cc=simon.horman@netronome.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®