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 B0BCCC74A5B for ; Fri, 17 Mar 2023 14:22:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230307AbjCQOW5 (ORCPT ); Fri, 17 Mar 2023 10:22:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39730 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230266AbjCQOWy (ORCPT ); Fri, 17 Mar 2023 10:22:54 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AA70BB6D37 for ; Fri, 17 Mar 2023 07:22:51 -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 9201E622D2 for ; Fri, 17 Mar 2023 14:22:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A4D6BC43445; Fri, 17 Mar 2023 14:22:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1679062970; bh=3ktVK6Z8SIxwNL0Mz7fVgn/MLXEkDRswjLHErgTAt3I=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=GFPhg1x7saXzyXl1qS+Aumi2krN61h+FRHC3BRzODf7E+qfK8qK0wmNUXn8lnMbKy O09xl0yRbj1yv2sgkc5O9XP4zHMUbtCqgz1SmMvpczn9H4EHc5y7o8BEMlISkn7AAf HX52lWQY/ApSyTyg//l1yGiADsjKbCMfT/930Ufw= Date: Fri, 17 Mar 2023 15:22:47 +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: <2713f092-5d21-ad5e-c5f4-87c927b18a27@enneenne.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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? > > 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. thanks, greg k-h