Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AB48BC6FD1D for ; Fri, 17 Mar 2023 17:07:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230075AbjCQRHJ (ORCPT ); Fri, 17 Mar 2023 13:07:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47198 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230224AbjCQRGy (ORCPT ); Fri, 17 Mar 2023 13:06:54 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A6C804C6F2 for ; Fri, 17 Mar 2023 10:06:43 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id B82BE60DF6 for ; Fri, 17 Mar 2023 17:06:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CA672C433EF; Fri, 17 Mar 2023 17:06:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1679072802; bh=jiDGsqRzlRcCtmQwsHMBFR0ipayvPpuWQ/T8IQ9YOGs=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=VtjTPo2OfHs1ld2M/QAPOBsUNmbHMxgUsveATgEhEebgcfQKdW0rgr9ijO40QqZmE eajD6pCLR3AdTUODKx8mHttgTJBRyGnJDeteBxDnZZSGM7wT1n+2GEg7zUIV8KU3YA BvuNWTMrEZqOwIQpZTReMJ4n+/wY+a/hUNT+F8UU= Date: Fri, 17 Mar 2023 18:06:34 +0100 From: Greg KH To: Rodolfo Giometti Cc: Alex Komrakov , linux-kernel@vger.kernel.org Subject: Re: [PATCH v4] pps: Add elapsed realtime timestamping Message-ID: References: <20230317074739.193965-1-alexander.komrakov@broadcom.com> <2713f092-5d21-ad5e-c5f4-87c927b18a27@enneenne.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Mar 17, 2023 at 05:34:28PM +0100, Rodolfo Giometti wrote: > On 17/03/23 15:22, Greg KH wrote: > > On Fri, Mar 17, 2023 at 03:04:31PM +0100, Rodolfo Giometti wrote: > > > On 17/03/23 10:51, Alex Komrakov wrote: > > > > > +? ? ?if (!(pps->info.mode & PPS_CAPTURECLEAR)) > > > > > +? ? ? ? ? ? ?return 0; ? Why are you not returning an error? > > > > [AK] I used the style in this file sysfs.c. > > > > ?assert_show() and clear_show()? have the same condition. > > > > When '& PPS_CAPTURECLEAR' -- 0 means no interrupt asserted? and it is not error > > > > Probably Rodolfo can get more info why return 0 > > > > > > It's just as Alex said, if the PPS source has no PPS_CAPTUREASSERT or > > > PPS_CAPTURECLEAR mode it should not print ASSERT and CLEAR info. > > > > But shouldn't you return an error instead of an empty string? > > This is not an error... it's just a disabled capability. :) Then maybe return "0" or something like that? > > > > And why are these sysfs files even present if the mode is not set > > > > properly?? Can the mode be set while the device is attached or is this > > > > only defined at probe time?? If at probe time, just never create these > > > > files. > > > > [AK] we can understand mode is set when interrupts?asserted?and > > > > file?assert_elapsed will be updated. > > > > > > PPS source's "mode bits" can be set at runtime via PPS_SETPARAMS. > > > > Ok, that's good to know. But I think the error return value is a better > > indication that something went wrong here and this attribute does not > > work for this device at this point in time. > > I see... however I suppose several code relays on this behavior. If that's the case, then you are right, you can't change it, and I'll stop complaining here :) What tools use these sysfs files? How did you test your changes? thanks, greg k-h