From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 16735C11F67 for ; Tue, 13 Jul 2021 20:21:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 020FE61380 for ; Tue, 13 Jul 2021 20:21:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235251AbhGMUYF (ORCPT ); Tue, 13 Jul 2021 16:24:05 -0400 Received: from mga02.intel.com ([134.134.136.20]:18055 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235144AbhGMUYE (ORCPT ); Tue, 13 Jul 2021 16:24:04 -0400 X-IronPort-AV: E=McAfee;i="6200,9189,10044"; a="197421626" X-IronPort-AV: E=Sophos;i="5.84,237,1620716400"; d="scan'208";a="197421626" Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Jul 2021 13:21:12 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.84,237,1620716400"; d="scan'208";a="649643241" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga006.fm.intel.com with ESMTP; 13 Jul 2021 13:21:09 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 215A0551; Tue, 13 Jul 2021 23:21:37 +0300 (EEST) From: Andy Shevchenko To: Mauro Carvalho Chehab , Sakari Ailus , Andy Shevchenko , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Yong Zhi , Bingbu Cao , Dan Scally , Tianshu Qiu , Mauro Carvalho Chehab Subject: [PATCH v1 4/6] media: ipu3-cio2: Introduce to_sensor_asd() helper macro Date: Tue, 13 Jul 2021 23:21:29 +0300 Message-Id: <20210713202131.13906-4-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210713202131.13906-1-andriy.shevchenko@linux.intel.com> References: <20210713202131.13906-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Provide to_sensor_asd() helper macro and convert users to make code easier to read. Signed-off-by: Andy Shevchenko --- drivers/media/pci/intel/ipu3/ipu3-cio2-main.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/media/pci/intel/ipu3/ipu3-cio2-main.c b/drivers/media/pci/intel/ipu3/ipu3-cio2-main.c index 2f8ded58a949..8abb34f47b7b 100644 --- a/drivers/media/pci/intel/ipu3/ipu3-cio2-main.c +++ b/drivers/media/pci/intel/ipu3/ipu3-cio2-main.c @@ -1372,6 +1372,8 @@ struct sensor_async_subdev { struct csi2_bus_info csi2; }; +#define to_sensor_asd(asd) container_of(asd, struct sensor_async_subdev, asd) + /* The .bound() notifier callback when a match is found */ static int cio2_notifier_bound(struct v4l2_async_notifier *notifier, struct v4l2_subdev *sd, @@ -1379,8 +1381,7 @@ static int cio2_notifier_bound(struct v4l2_async_notifier *notifier, { struct cio2_device *cio2 = container_of(notifier, struct cio2_device, notifier); - struct sensor_async_subdev *s_asd = container_of(asd, - struct sensor_async_subdev, asd); + struct sensor_async_subdev *s_asd = to_sensor_asd(asd); struct cio2_queue *q; if (cio2->queue[s_asd->csi2.port].sensor) @@ -1402,8 +1403,7 @@ static void cio2_notifier_unbind(struct v4l2_async_notifier *notifier, { struct cio2_device *cio2 = container_of(notifier, struct cio2_device, notifier); - struct sensor_async_subdev *s_asd = container_of(asd, - struct sensor_async_subdev, asd); + struct sensor_async_subdev *s_asd = to_sensor_asd(asd); cio2->queue[s_asd->csi2.port].sensor = NULL; } @@ -1421,7 +1421,7 @@ static int cio2_notifier_complete(struct v4l2_async_notifier *notifier) int ret; list_for_each_entry(asd, &cio2->notifier.asd_list, asd_list) { - s_asd = container_of(asd, struct sensor_async_subdev, asd); + s_asd = to_sensor_asd(asd); q = &cio2->queue[s_asd->csi2.port]; for (pad = 0; pad < q->sensor->entity.num_pads; pad++) -- 2.30.2