Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp2754469pxb; Thu, 11 Feb 2021 23:46:04 -0800 (PST) X-Google-Smtp-Source: ABdhPJxGAe/v4JTjWTmoxjRR7ODFbiQjfsEueeaaJxSN87FlDLlrGzMBd+D8/mjj2lAh8fmr0bGP X-Received: by 2002:a17:906:688e:: with SMTP id n14mr1429231ejr.205.1613115964212; Thu, 11 Feb 2021 23:46:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613115964; cv=none; d=google.com; s=arc-20160816; b=M9xlnm1P0BOXXVhfMkZpjpmAgpvbmhFs76lNRNVmq4xLC1q6qdD1NT0hcqCY2xnWsl dMLkX27iYf/Zg3VqpVIG2z++PasL65UZbYlAGvzCoPG9hbCalFI0+prS+d3lcmb+8OSn y81t3D/PArG1Tr13aYv53ipARN0oUtfUdPFrFhZ+bpt3bBmzbF9EpiS5o3czWn9MwX7b bRXxMznvqeZthLCTKyRZktusPljRt/nr2noFiMLIQJNJxNarfpUf76TSFTpu/c3ZWAfv gpD3MFyRWmXGnafUAT4Zni3ugOHphaYxG/iSGt8y2GrVD7hYDvRpIPJGU2XjmTJu0FDs Cd4Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=mV36lQsoPiMrs8bh70lVeqUj/ohJdWqJtbqfSJChsY4=; b=Gz8NYqiq25SPe0IdrQ9Xquk9agljih/e7ncvcKdf9/D5sNu5xe7bXiZlrk2CUyBIT1 GrBVIMSfHq05mUlMQU/C6R6VvjFO3BixNJOoNeRkISoWlNYtJf4JMTWmON/pRdSsw0LQ WiiPtHdTwTEgFZ93hbOWd+xupW+x7rloISZcXo1sowTcMoJ/VlxSczFT5US4/9tYRPG3 JfBuHWIydWAZ/v/JuElO50ZrE7Iv5kRyj+ERn0FuFQl8O+AzEi2JzGJS14bHEe4yyaDn riJNXn0Cg3Db7lXSWnYnJeiCxzaz+Lq/2NqOAM8XyESbL5cGColC0q8q1fmOF1dUz5Qs ah0g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=KL4wts0y; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b15si5720104ejg.7.2021.02.11.23.45.41; Thu, 11 Feb 2021 23:46:04 -0800 (PST) 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; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=KL4wts0y; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229896AbhBLHms (ORCPT + 99 others); Fri, 12 Feb 2021 02:42:48 -0500 Received: from mail.kernel.org ([198.145.29.99]:45122 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229710AbhBLHkH (ORCPT ); Fri, 12 Feb 2021 02:40:07 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 4C36564DD6; Fri, 12 Feb 2021 07:39:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1613115566; bh=Gnb01Zlt7JlELKwkyjC2FjCJvYfhhVCdeifBUFpHFkU=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=KL4wts0ySgi1Xwt3fBv2gOOK8brB/EKoPhxiONVibR22++V9jH8K6h8b9LRwK7ocV 1+Tu3wDeyxmIdwAVLnlk5or5j5RtvJOetlhSfCxlRjG7GdTi4ue918mHrmZJiYuPB7 gnyOjGbFJsDcShugcQhC8sHkHkhtYmzFAVhdHrp8= Date: Fri, 12 Feb 2021 08:39:24 +0100 From: Greg KH To: min.li.xe@renesas.com Cc: derek.kiernan@xilinx.com, dragan.cvetic@xilinx.com, arnd@arndb.de, linux-kernel@vger.kernel.org Subject: Re: [PATCH net-next v2] misc: Add Renesas Synchronization Management Unit (SMU) support Message-ID: References: <1613092575-17311-1-git-send-email-min.li.xe@renesas.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1613092575-17311-1-git-send-email-min.li.xe@renesas.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Feb 11, 2021 at 08:16:15PM -0500, min.li.xe@renesas.com wrote: > +static int > +rsmu_open(struct inode *iptr, struct file *fptr) > +{ > + struct rsmu_cdev *rsmu; > + > + rsmu = container_of(iptr->i_cdev, struct rsmu_cdev, rsmu_cdev); > + if (!rsmu) > + return -EAGAIN; > + > + /* Only one open per device at a time */ > + if (!atomic_dec_and_test(&rsmu->open_count)) { > + atomic_inc(&rsmu->open_count); > + return -EBUSY; This does not do what you think it does, and does not prevent multiple applications from talking to your device at the same time. There is no need for this at all, as it does not work, sorry. If multiple apps talk to your device, it's their fault, not the kernel's fault, that things go wrong. And I thought that Arnd already told you to fix this? thanks, greg k-h