From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S966424AbcAZO7R (ORCPT ); Tue, 26 Jan 2016 09:59:17 -0500 Received: from smtp.codeaurora.org ([198.145.29.96]:47031 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S966399AbcAZO7K (ORCPT ); Tue, 26 Jan 2016 09:59:10 -0500 Subject: Re: [PATCH v4 1/6] drm/dsi: check for CONFIG_OF when defining of_mipi_dsi_device_add To: Thierry Reding References: <1448884892-7731-1-git-send-email-architt@codeaurora.org> <1449751300-2841-1-git-send-email-architt@codeaurora.org> <1449751300-2841-2-git-send-email-architt@codeaurora.org> <20160121153118.GA647@ulmo.nvidia.com> Cc: dri-devel@lists.freedesktop.org, a.hajda@samsung.com, jani.nikula@linux.intel.com, linux-kernel@vger.kernel.org, airlied@linux.ie, daniel@ffwll.ch, l.stach@pengutronix.de, robh@kernel.org, linux-arm-msm@vger.kernel.org From: Archit Taneja Message-ID: <56A789B4.3060304@codeaurora.org> Date: Tue, 26 Jan 2016 20:29:00 +0530 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.5.1 MIME-Version: 1.0 In-Reply-To: <20160121153118.GA647@ulmo.nvidia.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 1/21/2016 9:01 PM, Thierry Reding wrote: > On Thu, Dec 10, 2015 at 06:11:35PM +0530, Archit Taneja wrote: >> of_mipi_dsi_device_add is used only when CONFIG_OF is enabled. It >> currently works if OF support is disabled, but this will change >> when we add more functionality to it. >> >> Define the original func if CONFIG_OF is enabled. Define a dummy func >> otherwise. >> >> Signed-off-by: Archit Taneja >> --- >> drivers/gpu/drm/drm_mipi_dsi.c | 8 ++++++++ >> 1 file changed, 8 insertions(+) >> >> diff --git a/drivers/gpu/drm/drm_mipi_dsi.c b/drivers/gpu/drm/drm_mipi_dsi.c >> index 2d5ca8ee..bced235 100644 >> --- a/drivers/gpu/drm/drm_mipi_dsi.c >> +++ b/drivers/gpu/drm/drm_mipi_dsi.c >> @@ -129,6 +129,7 @@ static int mipi_dsi_device_add(struct mipi_dsi_device *dsi) >> return device_add(&dsi->dev); >> } >> >> +#if IS_ENABLED(CONFIG_OF) >> static struct mipi_dsi_device * >> of_mipi_dsi_device_add(struct mipi_dsi_host *host, struct device_node *node) >> { >> @@ -170,6 +171,13 @@ of_mipi_dsi_device_add(struct mipi_dsi_host *host, struct device_node *node) >> >> return dsi; >> } >> +#else >> +static struct mipi_dsi_device * >> +of_mipi_dsi_device_add(struct mipi_dsi_host *host, struct device_node *node) >> +{ >> + return NULL; >> +} >> +#endif > > The OF implementation of this function never returns NULL, so perhaps > this should return an ERR_PTR()-encoded error code instead? This isn't > really important because we never check the return value in the one > call-site that we have, which I guess could be an argument for removing > the return value altogether... You're right. I'll replace this with ERR_PTR(-ENODEV). Maybe we could keep the return value in case we use it in the future. Thanks, Archit > > Thierry > -- Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project