From patchwork Sat Sep 28 17:23:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ricardo Ribalda X-Patchwork-Id: 831238 Received: from mail-qv1-f44.google.com (mail-qv1-f44.google.com [209.85.219.44]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6CF9013E41D for ; Sat, 28 Sep 2024 17:24:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.44 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727544255; cv=none; b=E/yBbLNLULZ6cV73eglGrB/pjEacMLWGOZ6pzmRI/aZgaSoGKa4sGa2d0NrdlDvdN0LB9/H16HbYqRedvcf03rO0NkFoWhP92CkhH60XhgHU5LcfXEcjJAhYQPke57ZiwNgQVzN3ULhuE1NGKItBVISv7JVvEoq9hR+xlyE4tXo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727544255; c=relaxed/simple; bh=7sRFEvOMAKX7Ysy8UcKQeNTyXMyRWw/ITXhkyrrNZQs=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=CW8obeYM7ej8+xO85og+158ugAs5uY+kztkPv+E/7DvYJaxA2kOdRR7rErXshRe9k0hgepH6KHTu7+m7xGtswTBT1pICErssVSdV9Quwlz971upyPynHeZtfGvgVi4RXPSmEiFmGB9emZpEXXzxJigRGVaPwDRWzBr9XAN8XVG0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org; spf=pass smtp.mailfrom=chromium.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b=TZOzlVB3; arc=none smtp.client-ip=209.85.219.44 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="TZOzlVB3" Received: by mail-qv1-f44.google.com with SMTP id 6a1803df08f44-6c3f12d3930so25385996d6.3 for ; Sat, 28 Sep 2024 10:24:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1727544253; x=1728149053; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=b4qc8zfewwgHSkiXCkO1G3tDslgxzxahIfATlUdU/50=; b=TZOzlVB3v5hguijblpVvAAcJoByRBofwsRFchOrW0ZUnkHY8ZlD+y5dNyNNJ87QwJ7 hFovormxS/YWnUBF8Tf358NBKvYwZrGh4MQ1t3KxlmmWdw7jehOW4GytZyOpS+MNsQoc dktIEH2j8OfKY+R3Ls7dTfsxqudaqCmC/WGSQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727544253; x=1728149053; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=b4qc8zfewwgHSkiXCkO1G3tDslgxzxahIfATlUdU/50=; b=rhZ++NPXzNLytE0+41mrJcnRYdqSv3WNpch1kveB01ENU1z/6Ov+tNier5p5ZJeawl kIysk6QqvM70HnXcNyOuR3MHBhMuUhK0+rgM3uo7bjwwP0w8+NS1iPb7BimHWDXaddzT TR0kCd9USDORzaglXi7s9YmZAQ7ADH0nZ9V5UUYlHhRceSCTPicodxJ8W2LI9JWUTgoP cs2QUG/5BaHXl3K2vg9h4eJPrpq7uwlht0kR+2ickKX1kMB1x/zApHp+pAmBi7oYouEo uW9hUKdRObUoA++mpeU+mKampTbJZIP4Rsc5fI1DzMa16bQKZ9re/0S7bIIbpRWrl64I sPjg== X-Gm-Message-State: AOJu0YwWdBd/TWgX6I1zOzsLcnpYj0q0y5NV2iHzjF8BBrn0T+XocB1f nsyL9hoGJYv3ZJFAH4kvlsTm6Mtn02qVAYKqnhyiObKOj3Q3hSMNyFJ99jnBlg== X-Google-Smtp-Source: AGHT+IHwEPblocGstpOT+vVO6hqhZ+nCAX+DqBguQK/Wg4w8ON4sghOsgRC6QVX4V1SR7wl9ChkfXA== X-Received: by 2002:a05:6214:4586:b0:6cb:3883:bdbb with SMTP id 6a1803df08f44-6cb3b5e5107mr128948076d6.25.1727544253378; Sat, 28 Sep 2024 10:24:13 -0700 (PDT) Received: from denia.c.googlers.com (76.224.245.35.bc.googleusercontent.com. [35.245.224.76]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-6cb3b68311dsm21437756d6.122.2024.09.28.10.24.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 28 Sep 2024 10:24:12 -0700 (PDT) From: Ricardo Ribalda Date: Sat, 28 Sep 2024 17:23:58 +0000 Subject: [PATCH v3 1/3] media: ti: cal: Use str_up_down() Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240928-cocci-6-12-v3-1-53fc5ed20be0@chromium.org> References: <20240928-cocci-6-12-v3-0-53fc5ed20be0@chromium.org> In-Reply-To: <20240928-cocci-6-12-v3-0-53fc5ed20be0@chromium.org> To: Benoit Parrot , Mauro Carvalho Chehab , Sakari Ailus , Bingbu Cao , Tianshu Qiu , Greg Kroah-Hartman , Hans de Goede , Andy Shevchenko , Hans Verkuil Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-staging@lists.linux.dev, Ricardo Ribalda X-Mailer: b4 0.13.0 The str_up_down() helper simplifies the code and fixes the following cocci warning: drivers/media/platform/ti/cal/cal-camerarx.c:194:3-9: opportunity for str_up_down(enable) Signed-off-by: Ricardo Ribalda --- drivers/media/platform/ti/cal/cal-camerarx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/platform/ti/cal/cal-camerarx.c b/drivers/media/platform/ti/cal/cal-camerarx.c index 42dfe08b765f..80ad4a19c07b 100644 --- a/drivers/media/platform/ti/cal/cal-camerarx.c +++ b/drivers/media/platform/ti/cal/cal-camerarx.c @@ -191,7 +191,7 @@ static void cal_camerarx_power(struct cal_camerarx *phy, bool enable) if (i == 10) phy_err(phy, "Failed to power %s complexio\n", - enable ? "up" : "down"); + str_up_down(enable)); } static void cal_camerarx_wait_reset(struct cal_camerarx *phy) From patchwork Sat Sep 28 17:24:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ricardo Ribalda X-Patchwork-Id: 831237 Received: from mail-qv1-f44.google.com (mail-qv1-f44.google.com [209.85.219.44]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2762C161326 for ; Sat, 28 Sep 2024 17:24:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.44 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727544260; cv=none; b=RhRIfwj9c7meEyB0zuwfF2MYi7pC7i39jxFx5p/eUcR/rP/KWBPb9Sq7cwqqAPMTqpTEElyjyuCB2UjcXyyAohn45NuNqeyLTWnUyTBTR1ak8gSmWuL/T820VGU5estzfYnJaxhUO6STwOA3mLUsaSU2Pi841bf/CgIIEhTr0Jw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727544260; c=relaxed/simple; bh=hgkkoJn8PRzdejp8I35gJaE8ZuE8GBz1RxcmW/6Wl+g=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=R59UL8kMVE4dT1kCag9HZ9zj0MMQqZmrG4vz3B+rt1pasEuhTM9mlJdu4yMZPhnfdm4c0z6LD+/DQFMhXvTcqjVu5kVTg8fqiGqxylKe672dK9+WjAgD/QG+QpOfOBvDbWMuiPWvTQB2eyUXu9qG6Z3vWyzpQbUzUtNnc9oAMGc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org; spf=pass smtp.mailfrom=chromium.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b=gGP4UWxi; arc=none smtp.client-ip=209.85.219.44 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="gGP4UWxi" Received: by mail-qv1-f44.google.com with SMTP id 6a1803df08f44-6cb3bbb9cf5so19000056d6.1 for ; Sat, 28 Sep 2024 10:24:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1727544258; x=1728149058; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=0V4zAv66G9UTs98/sxGH5EUfTLy7Jj/aYXT4lmuMNEQ=; b=gGP4UWxigzZMNWCVVy9+SQBgmVXRcrwXOfz5rJqGQGO1ARuQL4UoY2/MQXj/JOoeJr DKjw2dbHAjtHjvDS+3quGpwpgikOmHrHEveksb+XOzAUz6BziS5ZEVNoDW3y3k4LRKgb NK6+zGoakPQuC4dCPkbJ6fUtrS21S/gMd5waI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727544258; x=1728149058; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=0V4zAv66G9UTs98/sxGH5EUfTLy7Jj/aYXT4lmuMNEQ=; b=UBDSF5c6npMyfuuXmIh/yeRxfWmJJd3sJBHaQ3PHKlf1sY2jp95pDCRGNQWTLK8Egq Gs1/EZSr9Bo/NlQhzoQo5kMj0BuDseRQ/aMkwkFWHVASXplWZqVDUbpWPTRMgYmE+kvb gUljNi8Qz3v+I+UMmr+/wT/EeMP4H8RDc9O/Mmu5nHnz/yfZ8yfYutvzyZbuDIiX3YDv S+wuRcoVEpB3sxZ5oNtwVc9Z/gsR+Ln+xiw0EWB3zW+t1mfh4eg0x47bLUr675QtwRsS V7LwrdGeTW8fXtTOFhYBC2PQiVlFpllL9a/OiUdBU5HJhmuwpWHlrug8GuT8mGUx3nfr NbYg== X-Gm-Message-State: AOJu0YyLj0UPdveVYKnCXAhxFGY7vOP0j4uMaKzeU+iMedcwOI5MvdR3 MFVmGOol4LUQQ2ygMoQw8uoJazZe3JdapILDGTp/udLo/u12+GQvc/HNi3fTag== X-Google-Smtp-Source: AGHT+IH+tjSCRlTFxQ4PkHc9qIvV7UgaC6LscTYg12k3dh3Dx2AnhCdOqFqATrCtJLZthR1CXmZWqA== X-Received: by 2002:a05:6214:5d8f:b0:6c5:50be:dd74 with SMTP id 6a1803df08f44-6cb3b64cb65mr103688526d6.45.1727544257964; Sat, 28 Sep 2024 10:24:17 -0700 (PDT) Received: from denia.c.googlers.com (76.224.245.35.bc.googleusercontent.com. [35.245.224.76]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-6cb3b68311dsm21437756d6.122.2024.09.28.10.24.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 28 Sep 2024 10:24:16 -0700 (PDT) From: Ricardo Ribalda Date: Sat, 28 Sep 2024 17:24:00 +0000 Subject: [PATCH v3 3/3] media: atomisp: Replace ternary operator with if Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240928-cocci-6-12-v3-3-53fc5ed20be0@chromium.org> References: <20240928-cocci-6-12-v3-0-53fc5ed20be0@chromium.org> In-Reply-To: <20240928-cocci-6-12-v3-0-53fc5ed20be0@chromium.org> To: Benoit Parrot , Mauro Carvalho Chehab , Sakari Ailus , Bingbu Cao , Tianshu Qiu , Greg Kroah-Hartman , Hans de Goede , Andy Shevchenko , Hans Verkuil Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-staging@lists.linux.dev, Ricardo Ribalda X-Mailer: b4 0.13.0 Replace the ternary operator with an if. In this case the code is more clear and also fixes the following cocci warnings: drivers/staging/media/atomisp/pci/sh_css_frac.h:40:17-18: WARNING opportunity for max() drivers/staging/media/atomisp/pci/sh_css_frac.h:50:17-18: WARNING opportunity for max() Signed-off-by: Ricardo Ribalda Acked-by: Hans Verkuil --- drivers/staging/media/atomisp/pci/sh_css_frac.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/staging/media/atomisp/pci/sh_css_frac.h b/drivers/staging/media/atomisp/pci/sh_css_frac.h index 8ba65161f7a9..3191d2858f59 100644 --- a/drivers/staging/media/atomisp/pci/sh_css_frac.h +++ b/drivers/staging/media/atomisp/pci/sh_css_frac.h @@ -37,7 +37,8 @@ static inline int sDIGIT_FITTING(int v, int a, int b) int fit_shift = sFRACTION_BITS_FITTING(a) - b; v >>= sSHIFT; - v >>= fit_shift > 0 ? fit_shift : 0; + if (fit_shift > 0) + v >>= fit_shift; return clamp_t(int, v, sISP_VAL_MIN, sISP_VAL_MAX); } @@ -47,7 +48,8 @@ static inline unsigned int uDIGIT_FITTING(unsigned int v, int a, int b) int fit_shift = uFRACTION_BITS_FITTING(a) - b; v >>= uSHIFT; - v >>= fit_shift > 0 ? fit_shift : 0; + if (fit_shift > 0) + v >>= fit_shift; return clamp_t(unsigned int, v, uISP_VAL_MIN, uISP_VAL_MAX); }