From patchwork Tue Jan 9 14:26:38 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 10152383 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id E2CEA603ED for ; Tue, 9 Jan 2018 14:26:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BECFA23B24 for ; Tue, 9 Jan 2018 14:26:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B24BF26E4A; Tue, 9 Jan 2018 14:26:42 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2084C23B24 for ; Tue, 9 Jan 2018 14:26:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752840AbeAIO0k (ORCPT ); Tue, 9 Jan 2018 09:26:40 -0500 Received: from mail-qt0-f194.google.com ([209.85.216.194]:43986 "EHLO mail-qt0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752097AbeAIO0k (ORCPT ); Tue, 9 Jan 2018 09:26:40 -0500 Received: by mail-qt0-f194.google.com with SMTP id s3so2013403qtb.10 for ; Tue, 09 Jan 2018 06:26:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=Id1rkPrmOq9SiZ/OT3Nx4hODCEiTWfrfBmPiFdjgKaU=; b=Dyl3xsexU8lovo6PlZ4KOxvTcmQpcwQNKKBPWkOoF2UVtobHMjUSJthkt83qv6FUEq oezshqQhqwcDhTIpFINolp7CwQZwhTQXadZWeBK1nY5mKSs82s+UFKlIzAtHDQcphkWa zaZFODpjxB7WNDOX4yB9Qc5F5X+uZX19DbAdhuTylMmd5r63jaXU/sm8RSgNmcwh5+MM D+a9GqeK6pLLwwYytH/VOL0kGBc8Q0m5ZUyVRcx9PPSHhthHL+AOVSlioWNsLZqBDwil h1FckYA2LWft4lCpZxi8EP2iHi8n3YoNqbZPE1hFYVKrlNMrKszFx/f7jtiMvw1CuO3n dhIg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=Id1rkPrmOq9SiZ/OT3Nx4hODCEiTWfrfBmPiFdjgKaU=; b=Ba5+fgdWlXkqlszbtckro5aPV0dlf27LNNoWMZLvNhrxjAPph7aHL5KJqxh+h7JAj6 aU0mIv4kx4TXOlUWZV7N120NRmgfX18NQ/ZHVNKz1AIz7k3XdQ9m1CR/xlyZcoDO1YyA 5zaMBPKEnNkYkTQZ3Kyd77fYGRF15/XvNgqjRXchEDKHB+W9eqEANTX1ONrmVaPGftxW TDFZItEA/G3ws/+7AgcIYPbQCMZZrEJChndpGgQdcY9k2Hw88GoUEf0MMdOOYnUDTYiw d4HE550V3lWiNstB2uiAtJpixYjQ0LHaf/qiaG3Jz9p3vB/K7jnd3Bj9UQjuc0+ywK5q 2Xog== X-Gm-Message-State: AKwxyteIRWPms9nfuWpdsTeN7Fqwk4oj7qAeBz1qGkdGfeR4IfzRfpOf cQE0MSfkKDYWqNKh/ix6IAINr+h2WYu/e33bZvs= X-Google-Smtp-Source: ACJfBotVTopcmtxCtW4KvClvokp3BVDDCYI7fAfJ9s6x+9LFKoW6DvDSkY9NOQqMdfVA3n1duxJ05zuzPZ1b00VXJ2M= X-Received: by 10.237.33.243 with SMTP id m48mr21337697qtc.87.1515507999196; Tue, 09 Jan 2018 06:26:39 -0800 (PST) MIME-Version: 1.0 Received: by 10.237.33.208 with HTTP; Tue, 9 Jan 2018 06:26:38 -0800 (PST) In-Reply-To: <20180109135858.1964-1-sakari.ailus@linux.intel.com> References: <20180109135858.1964-1-sakari.ailus@linux.intel.com> From: Arnd Bergmann Date: Tue, 9 Jan 2018 15:26:38 +0100 X-Google-Sender-Auth: 5BPVyZ9tkC0FOsG0UMvHqg2Kva8 Message-ID: Subject: Re: [PATCH 1/1] media: entity: Add a nop variant of media_entity_cleanupr To: Sakari Ailus Cc: Linux Media Mailing List , Wenyou Yang , Hans Verkuil , Pavel Machek Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On Tue, Jan 9, 2018 at 2:58 PM, Sakari Ailus wrote: > Add nop variant of media_entity_cleanup. This allows calling > media_entity_cleanup whether or not Media controller is enabled, > simplifying driver code. > > Also drop #ifdefs on a few drivers around media_entity_cleanup() and drop > the extra semicolon from media_entity_cleanup prototype. > > Signed-off-by: Sakari Ailus > --- > Hi Arnd, > > I thought about doing something similar with media_entity_pads_init which is > equally commonly used in drivers that support MC/non-MC cases. The trouble > with that is that the drivers set up the struct first before calling > media_entity_pads_init, requiring the #ifdefs in any case. So the benefit > would be questionable at least. So just media_entity_cleanup this time. Looks good overall, just two thoughts: > diff --git a/include/media/media-entity.h b/include/media/media-entity.h > index d7a669058b5e..a732af1dbba0 100644 > --- a/include/media/media-entity.h > +++ b/include/media/media-entity.h > @@ -634,7 +634,11 @@ int media_entity_pads_init(struct media_entity *entity, u16 num_pads, > * This function must be called during the cleanup phase after unregistering > * the entity (currently, it does nothing). > */ > -static inline void media_entity_cleanup(struct media_entity *entity) {}; > +#if IS_ENABLED(CONFIG_MEDIA_CONTROLLER) > +static inline void media_entity_cleanup(struct media_entity *entity) {} > +#else > +#define media_entity_cleanup(entity) do { } while (false) > +#endif This might cause a harmless warning about an unused variable in case we have a driver that does: void f(struct i2c_client *client) { struct v4l2_subdev *sd = to_subdev(client); media_entity_cleanup(sd); } None of the drivers you changed would have an unused variable after your change (otherwise they would already have it before your change), so it's probably fine. and second, I'm trying the patch below on top of yours now, will see how far that gets us ;-) Arnd diff --git a/drivers/media/i2c/Kconfig b/drivers/media/i2c/Kconfig index 03cf3a1a1e06..6421da7cb58a 100644 --- a/drivers/media/i2c/Kconfig +++ b/drivers/media/i2c/Kconfig @@ -310,14 +310,14 @@ config VIDEO_ML86V7667 config VIDEO_AD5820 tristate "AD5820 lens voice coil support" - depends on I2C && VIDEO_V4L2 && MEDIA_CONTROLLER + depends on I2C && VIDEO_V4L2 ---help--- This is a driver for the AD5820 camera lens voice coil. It is used for example in Nokia N900 (RX-51). config VIDEO_DW9714 tristate "DW9714 lens voice coil support" - depends on I2C && VIDEO_V4L2 && MEDIA_CONTROLLER + depends on I2C && VIDEO_V4L2 depends on VIDEO_V4L2_SUBDEV_API ---help--- This is a driver for the DW9714 camera lens voice coil. @@ -636,7 +636,6 @@ config VIDEO_OV5670 tristate "OmniVision OV5670 sensor support" depends on I2C && VIDEO_V4L2 && VIDEO_V4L2_SUBDEV_API depends on MEDIA_CAMERA_SUPPORT - depends on MEDIA_CONTROLLER select V4L2_FWNODE ---help--- This is a Video4Linux2 sensor-level driver for the OmniVision @@ -667,7 +666,7 @@ config VIDEO_OV7670 config VIDEO_OV7740 tristate "OmniVision OV7740 sensor support" - depends on I2C && VIDEO_V4L2 && MEDIA_CONTROLLER + depends on I2C && VIDEO_V4L2 depends on MEDIA_CAMERA_SUPPORT ---help--- This is a Video4Linux2 sensor-level driver for the OmniVision @@ -815,7 +814,7 @@ comment "Flash devices" config VIDEO_ADP1653 tristate "ADP1653 flash support" - depends on I2C && VIDEO_V4L2 && MEDIA_CONTROLLER + depends on I2C && VIDEO_V4L2 depends on MEDIA_CAMERA_SUPPORT ---help--- This is a driver for the ADP1653 flash controller. It is used for @@ -823,7 +822,7 @@ config VIDEO_ADP1653 config VIDEO_LM3560 tristate "LM3560 dual flash driver support" - depends on I2C && VIDEO_V4L2 && MEDIA_CONTROLLER + depends on I2C && VIDEO_V4L2 depends on MEDIA_CAMERA_SUPPORT select REGMAP_I2C ---help--- @@ -832,7 +831,7 @@ config VIDEO_LM3560 config VIDEO_LM3646 tristate "LM3646 dual flash driver support" - depends on I2C && VIDEO_V4L2 && MEDIA_CONTROLLER + depends on I2C && VIDEO_V4L2 depends on MEDIA_CAMERA_SUPPORT select REGMAP_I2C ---help---