Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C82DD2F45 for ; Fri, 10 Feb 2023 13:18:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1676035127; x=1707571127; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=VVzHEiLMA9mnKXFENefJxvaonbt8ej/mKgkvRRdF0WY=; b=dFKYV4pCrpddAZqHeJj+2eK2frN71F23YhArlrmIYgEtpmy8dfeZx2Xu HPy5sDisYEc4Li8ZI54R4ZPkBPeQMfRtHYsZ9gxN3Rm3rxvnI8d9zw57L hgtlFYIQ0FYtFT+bz10cNF6VLuEtmiB36QZDPy4SLhkmb1KpCCtpfgzeb WfqcszEsXKY6SgbKjfFGtcqZ2HkqDLnVOI9bJM7vLe5iphbepnjNg/4st VPG317J1gSjZcXTfN6GyubNs7AaAovr5sGwDHvF6MnTEJGJ3SXiOeN4nK 26wu5KdtCmeauLm3+HM5Hu852vyBV00m4GY7n5QRgEQQUxRTj+d+cs3/l A==; X-IronPort-AV: E=McAfee;i="6500,9779,10616"; a="328105821" X-IronPort-AV: E=Sophos;i="5.97,287,1669104000"; d="scan'208";a="328105821" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Feb 2023 05:18:47 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10616"; a="810817244" X-IronPort-AV: E=Sophos;i="5.97,287,1669104000"; d="scan'208";a="810817244" Received: from turnipsi.fi.intel.com (HELO kekkonen.fi.intel.com) ([10.237.72.44]) by fmsmga001-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Feb 2023 05:18:44 -0800 Received: from kekkonen.localdomain (localhost [IPv6:::1]) by kekkonen.fi.intel.com (Postfix) with SMTP id C793311F9EF; Fri, 10 Feb 2023 15:18:41 +0200 (EET) Date: Fri, 10 Feb 2023 15:18:41 +0200 From: Sakari Ailus To: Hans de Goede Cc: Laurent Pinchart , Mauro Carvalho Chehab , Tsuchiya Yuto , Andy Shevchenko , Yury Luneff , Nable , andrey.i.trufanov@gmail.com, Fabio Aiuto , linux-media@vger.kernel.org, linux-staging@lists.linux.dev Subject: Re: [PATCH 28/57] media: Add ovxxxx_16bit_addr_reg_helpers.h Message-ID: References: <20230123125205.622152-1-hdegoede@redhat.com> <20230123125205.622152-29-hdegoede@redhat.com> <026272d3-88d7-a67f-4942-5cba6c3eab86@redhat.com> <4e501e71-a226-a022-83e2-f53686ca07a7@redhat.com> <3be27a04-21e5-5929-88a1-0159f554a36f@redhat.com> <30181cf6-7dc8-d75c-5d7a-93f483d4f045@redhat.com> Precedence: bulk X-Mailing-List: linux-staging@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <30181cf6-7dc8-d75c-5d7a-93f483d4f045@redhat.com> Hi Hans, On Fri, Feb 10, 2023 at 01:47:49PM +0100, Hans de Goede wrote: > > And if someone dislikes having to pass NULL for the last argument, we > > could use some macro magic to accept both the 3 arguments and 4 > > arguments variants. > > > > int __cci_write3(struct cci *cci, u32 reg, u32 val); > > int __cci_write4(struct cci *cci, u32 reg, u32 val, int *err); > > > > #define __cci_write(_1, _2, _3, _4, NAME, ...) NAME > > #define cci_write(...) __cci_write(__VA_ARGS__, __cci_write4, __cci_write3)(__VA_ARGS__) > > TBH this just feels like code obfuscation to me and it is also going > to write havoc with various smarted code-editors / IDEs which give > proptype info to the user while typing the function name. > > Having the extra ", NULL" there in calls which don't use / need > the *err thingie really is not a big deal IMHO. It's still an eyesore if the driver doesn't use that pattern of register access error handling. I also prioritise source code itself rather than try to make it fit for a particular editor (which is neither Emacs nor Vim I suppose?). My preference is to provide an interface that best suits a driver's needs, whatever that is. There are just a couple of common patterns and the one above is one of the rare ones. -- Regards, Sakari Ailus