Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp917901rwd; Thu, 15 Jun 2023 04:04:59 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4zOWPReCCx5jZuEUzXVggPHD55pynLOS/yJu3a9ZUtuS9ggsa6pcHIC/H4i/9PKfsEebHE X-Received: by 2002:a17:90a:8b92:b0:256:2ee5:aebc with SMTP id z18-20020a17090a8b9200b002562ee5aebcmr3065101pjn.18.1686827099300; Thu, 15 Jun 2023 04:04:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686827099; cv=none; d=google.com; s=arc-20160816; b=hEV8Yu6qN2pX1U5F1Glt98EfU2ONoTEIwfQyxTGs7kS98eb9u0fS6HqAZ7f4SVXaIB ssoE3lHl6U8kzWv6ZnDDPjmHnPIggkEbyvP/vE8t/ZZtkqniy8GA5c/hGVlfSuAMKqCR KchBVHhk0srd7PpMgmLjXD06QCgCRZQxkEC/AXJaDsd3BVV6Zq+wDU/dO/V8tzkXibgY IQyacA6KHNwjJdGjOwfTsggkQjOTK4bV7VaACoNI76jpqbacEQZ1Fn7RNd41ZD9xgwgb wI+iSAxUp93L3D5ZqH0Ocf6+zCHGM3hG+/rBQui8qvGQvHsJdL9e7Va9TgtbtiU3wQYm 9Qcg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:organization:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=aaSZbvTz83tY4ql8CtmCZ+6iiwiLEcGd3ocKXiazIzs=; b=gFMVwBinCfWSgDfDDwz2cocbs7mgX0I9khUMIMPPQw0trVzdJjMY/Yvj5akepF9JZA prKb8N3+/+XKhzjiStDtR1FfatMk+k4y7PN6ptot1mvKbF1T3a9lqcMadcBe1bCkwDK6 z2oPaaj2qN9IsliO4GGv/omRRMDPw72M8WD0cN39WT0EPF7XWP08G4FCLlj9vVzKHHt3 7dL7Kces9cA/24zwXOuubFYLIg5JhzoFHbMCKE+gzIMF7FFrCtSKt77K1l2Nzjg/GZaa TBO4nCZTCj4WcEa31JdoYHTa+pzN/aKFPz7jPv022hiJQKCiOjFZ5LIlshBTOzs8eRX4 AI/w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=J1gJiOkI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id kb8-20020a17090ae7c800b0025ea1c0edb1si444961pjb.146.2023.06.15.04.04.47; Thu, 15 Jun 2023 04:04:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=J1gJiOkI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243418AbjFOK6Z (ORCPT + 99 others); Thu, 15 Jun 2023 06:58:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58952 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240508AbjFOK6W (ORCPT ); Thu, 15 Jun 2023 06:58:22 -0400 Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AA4451FE4; Thu, 15 Jun 2023 03:58:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1686826701; x=1718362701; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=PlAk0+2pPNPfP2f5gUvJB/uBWEtPFah4b/xBlSuSeI0=; b=J1gJiOkI0kJMMU2izJkYDAp7jbyXM9rC5uLSRnQeoUzf13V6iZyuzE19 A7qLslqLS159FiJyk7DExHjXX3F68CUaLMqPtY4UMmlau+s8l+Pop0dax B+v4z/zr0iKzhF0xT0aaq9KXemUg2106Fto4uwD2zjZf0/ylIUAJwSpAH 2lAtEMSCvYsCwleVodhENHHcPnrxMYohskjcpwIzHj4jnuPiECyk+z93u 69PW9aHqB0tgE+/rMhMolo3nWZx+5870G9a/evDWcN/7dPHG++f7/3CWz DSL8WJ5l9kYbQKKweSYQ5TN5qWUANQXcaUe3LDzYQGJe21Bg6gB6yjiDT A==; X-IronPort-AV: E=McAfee;i="6600,9927,10741"; a="361358839" X-IronPort-AV: E=Sophos;i="6.00,244,1681196400"; d="scan'208";a="361358839" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Jun 2023 03:58:21 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10741"; a="825221195" X-IronPort-AV: E=Sophos;i="6.00,244,1681196400"; d="scan'208";a="825221195" Received: from smile.fi.intel.com ([10.237.72.54]) by fmsmga002.fm.intel.com with ESMTP; 15 Jun 2023 03:58:18 -0700 Received: from andy by smile.fi.intel.com with local (Exim 4.96) (envelope-from ) id 1q9kgD-003vGx-0C; Thu, 15 Jun 2023 13:58:17 +0300 Date: Thu, 15 Jun 2023 13:58:16 +0300 From: Andy Shevchenko To: Rasmus Villemoes Cc: Alexandre Belloni , Alessandro Zummo , devicetree@vger.kernel.org, Rob Herring , Krzysztof Kozlowski , Conor Dooley , linux-rtc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 5/8] rtc: isl12022: implement RTC_VL_READ ioctl Message-ID: References: <20230612113059.247275-1-linux@rasmusvillemoes.dk> <20230613130011.305589-1-linux@rasmusvillemoes.dk> <20230613130011.305589-6-linux@rasmusvillemoes.dk> <20230613212651c8770218@mail.local> <20230614135036a3e049c4@mail.local> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jun 15, 2023 at 12:53:24PM +0200, Rasmus Villemoes wrote: > On 14/06/2023 17.13, Andy Shevchenko wrote: > > When reading such a code the following questions are arisen: > > 1) Can the positive return value be the case? > > 2) If so, what is the meaning of a such? > > 3) Why do we not care about it? > > > > All this can simply gone if we use > > > > ret = foo(...); > > if (ret) > > return ret; > > > > As it's clear that whatever is non-zero we accept as something to be promoted > > to the upper layer. I hope this explains my position. > > But we're in a context (in this case an ->ioctl method) where _our_ > caller expects 0/-ESOMETHING, so returning something positive would be a > bug - i.e., either way of spelling that if(), the reader must know that > foo() also has those 0/-ESOMETHING semantics. I totally understand this. But then it's either problem of regmap API documentation or API itself. I.o.w. not _your_ problem. > I honestly didn't think much about it, but looking at the existing code > and the stuff I add, all other places actually do 'if (ret)', so I've > updated this site for consistency. Thank you! -- With Best Regards, Andy Shevchenko