lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID:
 <DB9PR04MB9452A0E23FD29D7A8DB17DECF4752@DB9PR04MB9452.eurprd04.prod.outlook.com>
Date: Sun, 29 Sep 2024 02:34:21 +0000
From: Sandor Yu <sandor.yu@....com>
To: Dmitry Baryshkov <dmitry.baryshkov@...aro.org>, Maxime Ripard
	<mripard@...nel.org>
CC: "andrzej.hajda@...el.com" <andrzej.hajda@...el.com>,
	"neil.armstrong@...aro.org" <neil.armstrong@...aro.org>, Laurent Pinchart
	<laurent.pinchart@...asonboard.com>, "jonas@...boo.se" <jonas@...boo.se>,
	"jernej.skrabec@...il.com" <jernej.skrabec@...il.com>, "airlied@...il.com"
	<airlied@...il.com>, "daniel@...ll.ch" <daniel@...ll.ch>,
	"robh+dt@...nel.org" <robh+dt@...nel.org>,
	"krzysztof.kozlowski+dt@...aro.org" <krzysztof.kozlowski+dt@...aro.org>,
	"shawnguo@...nel.org" <shawnguo@...nel.org>, "s.hauer@...gutronix.de"
	<s.hauer@...gutronix.de>, "festevam@...il.com" <festevam@...il.com>,
	"vkoul@...nel.org" <vkoul@...nel.org>, "dri-devel@...ts.freedesktop.org"
	<dri-devel@...ts.freedesktop.org>, "devicetree@...r.kernel.org"
	<devicetree@...r.kernel.org>, "linux-arm-kernel@...ts.infradead.org"
	<linux-arm-kernel@...ts.infradead.org>, "linux-kernel@...r.kernel.org"
	<linux-kernel@...r.kernel.org>, "linux-phy@...ts.infradead.org"
	<linux-phy@...ts.infradead.org>, "kernel@...gutronix.de"
	<kernel@...gutronix.de>, dl-linux-imx <linux-imx@....com>, Oliver Brown
	<oliver.brown@....com>, "alexander.stein@...tq-group.com"
	<alexander.stein@...tq-group.com>, "sam@...nborg.org" <sam@...nborg.org>
Subject: Re: [PATCH v17 4/8] drm: bridge: Cadence: Add MHDP8501 DP/HDMI driver

Hi Dmitry,

Thanks for your comments,

> 
> On Tue, Sep 24, 2024 at 12:16:27PM GMT, Maxime Ripard wrote:
> > On Tue, Sep 24, 2024 at 03:36:49PM GMT, Sandor Yu wrote:
> > > +static int cdns_mhdp8501_read_hpd(struct cdns_mhdp8501_device
> > > +*mhdp) {
> > > +   u8 status;
> > > +   int ret;
> > > +
> > > +   mutex_lock(&mhdp_mailbox_mutex);
> > > +
> > > +   ret = cdns_mhdp_mailbox_send(&mhdp->base,
> MB_MODULE_ID_GENERAL,
> > > +                                GENERAL_GET_HPD_STATE, 0,
> NULL);
> > > +   if (ret)
> > > +           goto err_get_hpd;
> > > +
> > > +   ret = cdns_mhdp_mailbox_recv_header(&mhdp->base,
> MB_MODULE_ID_GENERAL,
> > > +                                       GENERAL_GET_HPD_STATE,
> > > +                                       sizeof(status));
> > > +   if (ret)
> > > +           goto err_get_hpd;
> > > +
> > > +   ret = cdns_mhdp_mailbox_recv_data(&mhdp->base, &status,
> sizeof(status));
> > > +   if (ret)
> > > +           goto err_get_hpd;
> > > +
> > > +   mutex_unlock(&mhdp_mailbox_mutex);
> >
> > That's better I guess, but it's still not a good API design. If you
> > can't have concurrent accesses, then cdns_mhdp_mailbox_send et al.
> > should take the mutex themselves.
> 
> I think that a proper API might be:
> 
> int cdns_mhdp_mailbox_send_recv(struct cdns_mhdp_device *mhdp,
>                         u8 module_id, u8 opcode,
>                         u16 size, const u8 *message,
>                         u16 buf_size, u8 *buf);
> 
> Internally it should take the lock, exchange the data, then return.
> 

Thank you for your great suggestion. It seems like this should be able to solve the current problem.
I need to check each existing FW access functions one by one to see if they can all work under this API function.

B.R
Sandor

> --
> With best wishes
> Dmitry

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ