Received: by 2002:a05:6358:c692:b0:131:369:b2a3 with SMTP id fe18csp1575429rwb; Fri, 28 Jul 2023 11:23:51 -0700 (PDT) X-Google-Smtp-Source: APBJJlG4ifUBSGadmkAbkVktV8SZuWOm5Ze2DDAnquStJJioT6kwElrEeTUeh3YCuA0i/MqNMC+0 X-Received: by 2002:a2e:8801:0:b0:2b4:7f66:8c92 with SMTP id x1-20020a2e8801000000b002b47f668c92mr2367849ljh.31.1690568631135; Fri, 28 Jul 2023 11:23:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690568631; cv=none; d=google.com; s=arc-20160816; b=bIGPHEZCDdee4FS7b+F/xbKCenYAu/GFkjubJY6VuefcEONORIIU6ttzOF/rfL62JR m+CGe7El/cftvBEU+6/R/Pf+vP4uL+yMb5gFwSHNIhDh061V95Kfk6MlfpP6+I0oZ0ef w0H8MDTOIAyW/mujRhVfa2y7ueru39NWmIjCF/8Vv4kCAHq5/uyLTgZBuEhMJIdhEBQX CpiswlfFcKlsvP2nU7hnS6xTOLHLdFzIGb8gA2BqefT83WpnbP0pYQyG/fGS8aYRiXfv Ez3ifGQ9k7mV741TEaJmcyTU5QBYhhzkF/APjNVpw08hbDjkzzl9PI/eYQXS3YcGKrKk XynA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:autocrypt :from:references:cc:to:content-language:subject:user-agent :mime-version:date:message-id:dkim-signature; bh=JVWjcXDl51I+C9UlnxCYGcAWrlhLisPeGOSprqX5qlI=; fh=nxTtIXp+YeUW0dy9b6eCXd9HvCzACw07E51P+fRCTrE=; b=XN6w9AnxlMvZBz7lylXk8XIc3PcsIfGhmZnmEpkchG+jfhtCckY3uNXiqWbztZtsE8 KFLuJKkXZaCxskFOiAad5VYR/2C+qvJLXCf8CWUg0kp6con/fVfguo8qDjry/KFu5X6o Rjqq6NYWvYdIzxED9pPrw1Rr81XGk0MSUJNQDsjgqugbvrRyYO0rFkoPGIJu2Kx3N9RN qU8bh+2mCcAZhrbLe8uvsCrS2OxMnS3roKeL5/g3a0IrtcAtMZUf3G9DxFEEnSmJPU4v 1nQejb6Gn4PP/OAF5ez/FpudKoDTewajNsu2kYryXNGC/fW2fef/kwG/Z37NL9dLMcO8 Gtdg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="yFySC/3x"; 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=linaro.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f26-20020a170906495a00b00988e89079fesi2868832ejt.167.2023.07.28.11.23.24; Fri, 28 Jul 2023 11:23:51 -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=@linaro.org header.s=google header.b="yFySC/3x"; 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=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233357AbjG1RlY (ORCPT + 99 others); Fri, 28 Jul 2023 13:41:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37148 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234278AbjG1RlU (ORCPT ); Fri, 28 Jul 2023 13:41:20 -0400 Received: from mail-lf1-x12c.google.com (mail-lf1-x12c.google.com [IPv6:2a00:1450:4864:20::12c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CD5673A9A for ; Fri, 28 Jul 2023 10:41:18 -0700 (PDT) Received: by mail-lf1-x12c.google.com with SMTP id 2adb3069b0e04-4fba8f2197bso3947485e87.3 for ; Fri, 28 Jul 2023 10:41:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1690566077; x=1691170877; h=content-transfer-encoding:in-reply-to:autocrypt:from:references:cc :to:content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=JVWjcXDl51I+C9UlnxCYGcAWrlhLisPeGOSprqX5qlI=; b=yFySC/3xshuUNJw99b2CECHNYFBnjDLGeJDVlmDglxYcDHWRk+zN6AhheVvGHkMe0x nZW2rdGH5fZcTZJu9G3RWGHy8/Chrx917YLctxwl4kC67DVsUrT0Nqi/YtWAKgJeeMjp FnCILrkWg8AfQDMEHaMC6/n1SC1jERlmW+8oP5bzQPahZbq4sN+8rARdQBmleEsm7Jbc p+Pvif3dmSWDcgsshGNZPjv4Ghd+0EM36E60IR7eGIk+RsX/4+fD8LD8zOQ02zzJuc4o DdD1PEW3dvbCH8msshQmzK7MRCcC2ISiuVaL3kOBp/V7rS59ruYNr4nZwoA8/bEpqmQR PX5A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690566077; x=1691170877; h=content-transfer-encoding:in-reply-to:autocrypt:from:references:cc :to:content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=JVWjcXDl51I+C9UlnxCYGcAWrlhLisPeGOSprqX5qlI=; b=OdzXeuvsnsw5lb7t4ilDk68L//TBP31o4tIby2A9OSh3WdNa/QJDhlufb5klkc5HM7 X4hj8sob8Qo5mgQVBcfvafEUZN3NXXNLx68W7PEv5CzBuVThX7IupVpJSPgIZGCsOPiW QKXePeUB0VB2Y49FrPWVkrGajtjmJ+irBOAbNv4fRr5lU7nHuROMXSDXNiE36yEsi4Mg AzXAeX9jzRBtYqHe5B7egnUUgdS8eJeTigUN+eytWPbzgV09eyPn/2oBvBG2oFgdlh0Y dkSt1OE0Rl2zVyk3QmzV09l5GFS45q0UETZZQPy+2zRjr6nJHQSPFzK03k3t5/vKEnOm YI4Q== X-Gm-Message-State: ABy/qLbYIc5fi/dpSQomleIHqz3zo1jYZ5KhMsg4ZyH62b60x3NjYh8v N813U0NS4r2yI+wN3yx1VF/Fug== X-Received: by 2002:a05:6512:3d88:b0:4fe:18be:ef37 with SMTP id k8-20020a0565123d8800b004fe18beef37mr2678219lfv.61.1690566076947; Fri, 28 Jul 2023 10:41:16 -0700 (PDT) Received: from [192.168.1.101] (abyk53.neoplus.adsl.tpnet.pl. [83.9.30.53]) by smtp.gmail.com with ESMTPSA id q25-20020ac25299000000b004fbb1f7352csm888982lfm.72.2023.07.28.10.41.15 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 28 Jul 2023 10:41:16 -0700 (PDT) Message-ID: <7a727add-6aa6-fe3d-b2bd-7e0bd2f93579@linaro.org> Date: Fri, 28 Jul 2023 19:41:14 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 10/33] iris: vidc: add helper functions Content-Language: en-US To: Vikash Garodia , stanimir.k.varbanov@gmail.com, agross@kernel.org, andersson@kernel.org, mchehab@kernel.org, hans.verkuil@cisco.com, linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, linux-arm-msm@vger.kernel.org Cc: quic_dikshita@quicinc.com References: <1690550624-14642-1-git-send-email-quic_vgarodia@quicinc.com> <1690550624-14642-11-git-send-email-quic_vgarodia@quicinc.com> From: Konrad Dybcio Autocrypt: addr=konrad.dybcio@linaro.org; keydata= xsFNBF9ALYUBEADWAhxdTBWrwAgDQQzc1O/bJ5O7b6cXYxwbBd9xKP7MICh5YA0DcCjJSOum BB/OmIWU6X+LZW6P88ZmHe+KeyABLMP5s1tJNK1j4ntT7mECcWZDzafPWF4F6m4WJOG27kTJ HGWdmtO+RvadOVi6Co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0wQYezNzqS+FxoNXmDQg2jetX8en4bO2Di7Pmx0jXA4TOb9TM izWDgYvmBE8= In-Reply-To: <1690550624-14642-11-git-send-email-quic_vgarodia@quicinc.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=unavailable 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 28.07.2023 15:23, Vikash Garodia wrote: > This implements common helper functions for v4l2 to vidc and > vice versa conversion for different enums. > Add helpers for state checks, buffer management, locks etc. > > Signed-off-by: Dikshita Agarwal > Signed-off-by: Vikash Garodia > --- [...] > + > +#define is_odd(val) ((val) % 2 == 1) > +#define in_range(val, min, max) (((min) <= (val)) && ((val) <= (max))) > +#define COUNT_BITS(a, out) { \ hweight.* functions? [...] > + > +const char *cap_name(enum msm_vidc_inst_capability_type cap_id) > +{ > + const char *name = "UNKNOWN CAP"; Perhaps it'd be worth to include the unknown cap id here > + > + if (cap_id >= ARRAY_SIZE(cap_name_arr)) > + goto exit; > + > + name = cap_name_arr[cap_id]; > + > +exit: > + return name; > +} [...] > + > +const char *buf_name(enum msm_vidc_buffer_type type) > +{ > + const char *name = "UNKNOWN BUF"; Similarly here > + > + if (type >= ARRAY_SIZE(buf_type_name_arr)) > + goto exit; > + > + name = buf_type_name_arr[type]; > + > +exit: > + return name; > +} [...] > +const char *v4l2_type_name(u32 port) > +{ > + switch (port) { switch-case seems a bit excessive here. > + case INPUT_MPLANE: return "INPUT"; > + case OUTPUT_MPLANE: return "OUTPUT"; > + } > + > + return "UNKNOWN"; > +} [...] There's some more stuff I'd comment on, but 4500 lines in a single patch is way too much to logically follow. Couple more style suggestions: - use Reverse-Christmas-tree sorting for variable declarations - some oneliner functions could possibly become preprocessor macros - when printing giant debug messages, you may want to use loops - make sure your indentation is in order, 100 chars per line is totally fine - generally inline magic hex values are discouraged, but if they're necessary, the hex should be lowercase Konrad