Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp891303pxf; Wed, 7 Apr 2021 14:17:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwDucIwWeAs70uGsCHkJc78h2nAloCk3gD1lzmVkk2Xvz4nqTd4ZglPMQa5hdV8o5rUrzlD X-Received: by 2002:a05:6638:140e:: with SMTP id k14mr5365724jad.31.1617830238774; Wed, 07 Apr 2021 14:17:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617830238; cv=none; d=google.com; s=arc-20160816; b=aj4XHxJXnT7YV8ZHuyzoPxPKQM5/6MgGzSWeFBPEMktiUogAgF/DLBzrY/1yU9T4wk co3rJ1ezAM13kUq6aPGvQaHheSUB8MHVa5NZdhKTSMRRm0m3rCRPw3k8D3mkI63/eVNh 8QZw2QdH5K4F2jA2FsBb5dDBJto+oQQSM11leibXqGvtdoM+rFuq0MC3wGyxb/6z1TYO SKB7vEC+mhA8cYKcb9JCBXt6hwCqg8JEKnpNUULXtkoFxc29LRRo/4+/n2Xjh+6A7i/y H68xiVoiB9NPUDExxYCoynquYa1TFXA86htaRfJSDe0w5q1BjOWuSKdjxxdNayC6BJ3P /RHg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=Gaqw8HJqwq2dJZCRXZc2Y5jGPMm3sldHKF12f7jjJ9I=; b=ecdMQitq0wOfqhI1APmyOqDfiMa4RHquUeSk/ds6EOWtZuhnFj6ut3wlcpuea/OZEb 8YKas7P26ugNInR7bRD6UaVLd91B9vl9VNS838ljV8Dvzuyj5ODrRNBeB6JCAMdj/RO2 qxatYIdosDPydgPcrfBkcqX/A7L1h6A2VKaffcmEoXEcCCf+YIhfpHhCQQEz048yrhro Cc4T/7goVLEX2fsY/ImHAecj7X2UoJzGg7xpXmr7f1NQipAEky88iSmhoQd5X7ckrFMI rCYTWWImuJA+kKMmajfvosTVzhB/RIYiun4hJCCUeZODjEZNKOY5mffbtQtav570i3Dk 6j7g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z5si20773691ilh.73.2021.04.07.14.17.05; Wed, 07 Apr 2021 14:17:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1353521AbhDGP0q (ORCPT + 99 others); Wed, 7 Apr 2021 11:26:46 -0400 Received: from bhuna.collabora.co.uk ([46.235.227.227]:32968 "EHLO bhuna.collabora.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236449AbhDGP0e (ORCPT ); Wed, 7 Apr 2021 11:26:34 -0400 Received: from [IPv6:2a02:810a:880:f54:e4f9:6942:bb7c:e21] (unknown [IPv6:2a02:810a:880:f54:e4f9:6942:bb7c:e21]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: dafna) by bhuna.collabora.co.uk (Postfix) with ESMTPSA id 25C0D1F454D0; Wed, 7 Apr 2021 16:26:23 +0100 (BST) Subject: Re: [PATCH] drm: bridge: rename the function drm_bridge_hpd_notify to drm_bridge_hpd_cb To: Laurent Pinchart Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, kernel@collabora.com, dafna3@gmail.com, airlied@linux.ie, daniel@ffwll.ch, enric.balletbo@collabora.com References: <20210330115200.26006-1-dafna.hirschfeld@collabora.com> From: Dafna Hirschfeld Message-ID: <284cd4e3-b6a9-0b48-a01d-86d22f4f2e23@collabora.com> Date: Wed, 7 Apr 2021 17:26:18 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi On 06.04.21 14:40, Laurent Pinchart wrote: > Hi Dafna, > > Thank you for the patch. > > On Tue, Mar 30, 2021 at 01:52:00PM +0200, Dafna Hirschfeld wrote: >> drm_bridge_funcs has a function called 'hpd_notify'. >> The function drm_bridge_hpd_notify does not call >> 'hpd_notify' but it calls 'hpd_cb'. This is rather >> confusing. Rename the function to fix this confusion. >> >> Signed-off-by: Dafna Hirschfeld >> --- >> drivers/gpu/drm/bridge/adv7511/adv7511_drv.c | 2 +- >> drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c | 4 ++-- >> drivers/gpu/drm/bridge/display-connector.c | 2 +- >> drivers/gpu/drm/bridge/lontium-lt9611uxc.c | 8 ++++---- >> drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 2 +- >> drivers/gpu/drm/bridge/ti-tpd12s015.c | 2 +- >> drivers/gpu/drm/drm_bridge.c | 8 ++++---- >> include/drm/drm_bridge.h | 8 ++++---- >> 8 files changed, 18 insertions(+), 18 deletions(-) >> >> diff --git a/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c b/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c >> index 76555ae64e9c..748f82910f4f 100644 >> --- a/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c >> +++ b/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c >> @@ -449,7 +449,7 @@ static void adv7511_hpd_work(struct work_struct *work) >> cec_phys_addr_invalidate(adv7511->cec_adap); >> drm_kms_helper_hotplug_event(adv7511->connector.dev); >> } else { >> - drm_bridge_hpd_notify(&adv7511->bridge, status); >> + drm_bridge_hpd_cb(&adv7511->bridge, status); >> } >> } >> } >> diff --git a/drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c b/drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c >> index d0c65610ebb5..682da288ff6d 100644 >> --- a/drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c >> +++ b/drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c >> @@ -794,7 +794,7 @@ static void cdns_mhdp_fw_cb(const struct firmware *fw, void *context) >> if (mhdp->connector.dev) >> drm_kms_helper_hotplug_event(mhdp->bridge.dev); >> else >> - drm_bridge_hpd_notify(&mhdp->bridge, cdns_mhdp_detect(mhdp)); >> + drm_bridge_hpd_cb(&mhdp->bridge, cdns_mhdp_detect(mhdp)); >> } >> } >> >> @@ -2314,7 +2314,7 @@ static irqreturn_t cdns_mhdp_irq_handler(int irq, void *data) >> else >> drm_kms_helper_hotplug_event(mhdp->bridge.dev); >> } else { >> - drm_bridge_hpd_notify(&mhdp->bridge, cdns_mhdp_detect(mhdp)); >> + drm_bridge_hpd_cb(&mhdp->bridge, cdns_mhdp_detect(mhdp)); >> } >> } >> >> diff --git a/drivers/gpu/drm/bridge/display-connector.c b/drivers/gpu/drm/bridge/display-connector.c >> index 05eb759da6fc..8ccd69d7fe34 100644 >> --- a/drivers/gpu/drm/bridge/display-connector.c >> +++ b/drivers/gpu/drm/bridge/display-connector.c >> @@ -98,7 +98,7 @@ static irqreturn_t display_connector_hpd_irq(int irq, void *arg) >> struct display_connector *conn = arg; >> struct drm_bridge *bridge = &conn->bridge; >> >> - drm_bridge_hpd_notify(bridge, display_connector_detect(bridge)); >> + drm_bridge_hpd_cb(bridge, display_connector_detect(bridge)); >> >> return IRQ_HANDLED; >> } >> diff --git a/drivers/gpu/drm/bridge/lontium-lt9611uxc.c b/drivers/gpu/drm/bridge/lontium-lt9611uxc.c >> index fee27952ec6d..58f61b5da605 100644 >> --- a/drivers/gpu/drm/bridge/lontium-lt9611uxc.c >> +++ b/drivers/gpu/drm/bridge/lontium-lt9611uxc.c >> @@ -175,10 +175,10 @@ static void lt9611uxc_hpd_work(struct work_struct *work) >> connected = lt9611uxc->hdmi_connected; >> mutex_unlock(<9611uxc->ocm_lock); >> >> - drm_bridge_hpd_notify(<9611uxc->bridge, >> - connected ? >> - connector_status_connected : >> - connector_status_disconnected); >> + drm_bridge_hpd_cb(<9611uxc->bridge, >> + connected ? >> + connector_status_connected : >> + connector_status_disconnected); >> } >> } >> >> diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c >> index dda4fa9a1a08..984ab5c4bc71 100644 >> --- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c >> +++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c >> @@ -3026,7 +3026,7 @@ static irqreturn_t dw_hdmi_irq(int irq, void *dev_id) >> >> if (hdmi->bridge.dev) { >> drm_helper_hpd_irq_event(hdmi->bridge.dev); >> - drm_bridge_hpd_notify(&hdmi->bridge, status); >> + drm_bridge_hpd_cb(&hdmi->bridge, status); >> } >> } >> >> diff --git a/drivers/gpu/drm/bridge/ti-tpd12s015.c b/drivers/gpu/drm/bridge/ti-tpd12s015.c >> index e0e015243a60..2f079b6f51bc 100644 >> --- a/drivers/gpu/drm/bridge/ti-tpd12s015.c >> +++ b/drivers/gpu/drm/bridge/ti-tpd12s015.c >> @@ -103,7 +103,7 @@ static irqreturn_t tpd12s015_hpd_isr(int irq, void *data) >> struct tpd12s015_device *tpd = data; >> struct drm_bridge *bridge = &tpd->bridge; >> >> - drm_bridge_hpd_notify(bridge, tpd12s015_detect(bridge)); >> + drm_bridge_hpd_cb(bridge, tpd12s015_detect(bridge)); >> >> return IRQ_HANDLED; >> } >> diff --git a/drivers/gpu/drm/drm_bridge.c b/drivers/gpu/drm/drm_bridge.c >> index 64f0effb52ac..653761a0d5f9 100644 >> --- a/drivers/gpu/drm/drm_bridge.c >> +++ b/drivers/gpu/drm/drm_bridge.c >> @@ -1173,7 +1173,7 @@ void drm_bridge_hpd_disable(struct drm_bridge *bridge) >> EXPORT_SYMBOL_GPL(drm_bridge_hpd_disable); >> >> /** >> - * drm_bridge_hpd_notify - notify hot plug detection events >> + * drm_bridge_hpd_cb - notify hot plug detection events > > This function is still documented as notifying hot plug detection > events, so drm_bridge_hpd_cb() isn't a great name :-S I do agree there's > confusion with the current naming scheme though. > > bridge->hpd_cb() is an internal callback, not part of bridge ops, so I'd > rather not expose its name in the public drm_bridge_hpd_notify() API. > Could we find a better naming scheme ? I that bridge->funcs->hpd_notify is called only from drm_bridge_connector_hpd_notify which is called from both the hpd cb and from the 'detect' of the bridge connector. But 'detect' is not necesseraly by hpd right? I mean there is other ways apart of hpd to detect a connctor right? If that is the case then bridge->funcs->hpd_notify is also not a good name. Also, I see that in some places the function drm_bridge_connector_init is called without later calling the function drm_bridge_connector_enable_hpd. Is there a use case in which we want to create a bridge connector without enabeling the hpd_cb ? Regarding the naming, maybe we can replace 'drm_bridge_hpd_notify' with 'drm_bridge_hpd' ? Thanks, Dafna > >> * @bridge: bridge control structure >> * @status: output connection status >> * >> @@ -1183,15 +1183,15 @@ EXPORT_SYMBOL_GPL(drm_bridge_hpd_disable); >> * >> * This function shall be called in a context that can sleep. >> */ >> -void drm_bridge_hpd_notify(struct drm_bridge *bridge, >> - enum drm_connector_status status) >> +void drm_bridge_hpd_cb(struct drm_bridge *bridge, >> + enum drm_connector_status status) >> { >> mutex_lock(&bridge->hpd_mutex); >> if (bridge->hpd_cb) >> bridge->hpd_cb(bridge->hpd_data, status); >> mutex_unlock(&bridge->hpd_mutex); >> } >> -EXPORT_SYMBOL_GPL(drm_bridge_hpd_notify); >> +EXPORT_SYMBOL_GPL(drm_bridge_hpd_cb); >> >> #ifdef CONFIG_OF >> /** >> diff --git a/include/drm/drm_bridge.h b/include/drm/drm_bridge.h >> index 2195daa289d2..ab54715eda8b 100644 >> --- a/include/drm/drm_bridge.h >> +++ b/include/drm/drm_bridge.h >> @@ -605,7 +605,7 @@ struct drm_bridge_funcs { >> * @hpd_enable: >> * >> * Enable hot plug detection. From now on the bridge shall call >> - * drm_bridge_hpd_notify() each time a change is detected in the output >> + * drm_bridge_hpd_cb() each time a change is detected in the output >> * connection status, until hot plug detection gets disabled with >> * @hpd_disable. >> * >> @@ -620,7 +620,7 @@ struct drm_bridge_funcs { >> * @hpd_disable: >> * >> * Disable hot plug detection. Once this function returns the bridge >> - * shall not call drm_bridge_hpd_notify() when a change in the output >> + * shall not call drm_bridge_hpd_cb() when a change in the output >> * connection status occurs. >> * >> * This callback is optional and shall only be implemented by bridges >> @@ -878,8 +878,8 @@ void drm_bridge_hpd_enable(struct drm_bridge *bridge, >> enum drm_connector_status status), >> void *data); >> void drm_bridge_hpd_disable(struct drm_bridge *bridge); >> -void drm_bridge_hpd_notify(struct drm_bridge *bridge, >> - enum drm_connector_status status); >> +void drm_bridge_hpd_cb(struct drm_bridge *bridge, >> + enum drm_connector_status status); >> >> #ifdef CONFIG_DRM_PANEL_BRIDGE >> struct drm_bridge *drm_panel_bridge_add(struct drm_panel *panel); >