lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20150319075416.GB4568@localhost.localdomain>
Date:	Thu, 19 Mar 2015 08:54:16 +0100
From:	Richard Cochran <richardcochran@...il.com>
To:	Baolin Wang <baolin.wang@...aro.org>
Cc:	netdev@...r.kernel.org, linux-kernel@...r.kernel.org,
	john.stultz@...aro.com, tglx@...utronix.de, arnd@...aro.org
Subject: Re: [PATCH 2/4] ptp/clcok:Introduce the setktime/getktime interfaces
 with "ktime_t" type

On Thu, Mar 19, 2015 at 01:45:07PM +0800, Baolin Wang wrote:

> diff --git a/drivers/ptp/ptp_clock.c b/drivers/ptp/ptp_clock.c
> index 296b0ec..46425ad 100644
> --- a/drivers/ptp/ptp_clock.c
> +++ b/drivers/ptp/ptp_clock.c
> @@ -106,14 +106,30 @@ static int ptp_clock_getres(struct posix_clock *pc, struct timespec *tp)
>  
>  static int ptp_clock_settime(struct posix_clock *pc, const struct timespec *tp)
>  {
> +	ktime_t kt;
>  	struct ptp_clock *ptp = container_of(pc, struct ptp_clock, clock);
> -	return ptp->info->settime(ptp->info, tp);
> +
> +	if (ptp->info->setktime) {
> +		kt = timespec_to_ktime(*tp);
> +		return ptp->info->setktime(ptp->info, kt);
> +	} else {
> +		return ptp->info->settime(ptp->info, tp);
> +	}

This conditional is just the kind of thing I *don't* want to see.  In
Documentation/ptp/ptp.txt we read:

   ** Writing clock drivers

   Clock drivers include include/linux/ptp_clock_kernel.h and register
   themselves by presenting a 'struct ptp_clock_info' to the
   registration method. Clock drivers must implement all of the
   functions in the interface. If a clock does not offer a particular
   ancillary feature, then the driver should just return -EOPNOTSUPP
   from those functions.

Please don't litter the code with tests for NULL methods everywhere.

Thanks,
Richard
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ