lkml.org 
[lkml]   [2019]   [Apr]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 07/12] net: ll_temac: Support indirect_mutex share within TEMAC IP
On Fri, Apr 26, 2019 at 09:32:26AM +0200, Esben Haabendal wrote:
> @@ -1092,7 +1092,15 @@ static int temac_probe(struct platform_device *pdev)
> lp->dev = &pdev->dev;
> lp->options = XTE_OPTION_DEFAULTS;
> spin_lock_init(&lp->rx_lock);
> - mutex_init(&lp->indirect_mutex);
> +
> + /* Setup mutex for synchronization of indirect register access */
> + if (pdata && pdata->indirect_mutex) {
> + lp->indirect_mutex = pdata->indirect_mutex;
> + } else {
> + lp->indirect_mutex = devm_kmalloc(
> + &pdev->dev, sizeof(*lp->indirect_mutex), GFP_KERNEL);
> + mutex_init(lp->indirect_mutex);
> + }

Hi Esben

I would make the mutex mandatory, not optional. I think there will be
less hard to debug errors that way. You want the developer to actually
think about this mutex, should it be shared, or individual. Forcing
them to provide it means they are more likely to read the
documentation, and more likely to over share it than under share
it. That is maybe not so good for performance, but safer.

Andrew

\
 
 \ /
  Last update: 2019-04-26 16:15    [W:0.257 / U:0.608 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site