Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp1486542img; Tue, 19 Mar 2019 08:37:38 -0700 (PDT) X-Google-Smtp-Source: APXvYqx/rBTrF0VqwdtZDruUoTPgZROyVFBxghzdrVh/JNuILcj7v/Yho8aB4axqhTceZ6uZhwlF X-Received: by 2002:a63:c60c:: with SMTP id w12mr2423388pgg.446.1553009858763; Tue, 19 Mar 2019 08:37:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553009858; cv=none; d=google.com; s=arc-20160816; b=M5luEy4v4TvOG9LP2Duo/Nfnqg8eTkoHO72MgfBJYC0C7ekz9IP7OBx5a6I837PfCm VAjGpHaA8VvR6IpAi5+REopfnCfNeOOav2gXSzRk4zbbcalaRQUO6HbEUALoz3MeK38s FbRkte090nKIZPGKeaRYyHb2/HkBVZMVyZ3YPx9a8WBeDKPQ/R87MyetrdInbIG6fqMt pUkbq+Kfc/OTdjO1pLtupaQsgBQRNqGmZguegFYIef/EZ8KxTDf31z79d/fC5BO5S36w YbHDpaPyeQwN/kCTPf9/tpaxrxZ5dNEAwauGxDFbtu9sb4pRXmCs/yO8CfseeF5TAPk9 kJFA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version; bh=o0ndwrXvr1fDw8YN1AwbvOJecbQBOdygmtIAM9cY7Lw=; b=su+ysCUTl7gICvnPjyqr8lput0YRPMfSXBMGtYL+qj2v7YDdo2Sgg2nCraWy6oB4J2 +wVyMrN8qIVlJm3NPEHrV7mA/oE0A3B9grR6vcL1VIB7mcc7dTJ7hNJxKcrpxXFjDtFD UNTUppAuE29Vn2NtnsZefNxbDO30dqgANHe/qTNEdMJx/G9R8XUuJa8cXHH6wRQIZlT9 SIPjL57f7xOJaLWC2Ed6ENuaC0yHg4qrE8ezPg4MuGYWGto+PZhLM/rfILuc4COPNctL PayUMYd/jb1bFd31toQR2CURVQ2xmgxLC+GPw99qKGyuAmpxPp9ydEHJDc8PsHrKBs+b CktA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b27si11815974pgb.366.2019.03.19.08.37.23; Tue, 19 Mar 2019 08:37:38 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727579AbfCSPg2 (ORCPT + 99 others); Tue, 19 Mar 2019 11:36:28 -0400 Received: from mail-qt1-f195.google.com ([209.85.160.195]:45612 "EHLO mail-qt1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726831AbfCSPg2 (ORCPT ); Tue, 19 Mar 2019 11:36:28 -0400 Received: by mail-qt1-f195.google.com with SMTP id v20so22601924qtv.12 for ; Tue, 19 Mar 2019 08:36:28 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=o0ndwrXvr1fDw8YN1AwbvOJecbQBOdygmtIAM9cY7Lw=; b=GV82WmCLcS4bxmvYzvR17dhivD64pnH5joeBXDsAgvAKASvjL0stq4hLiqoqUIcRJC f+Kl6NbTfLZkjh1uwzZyIeaJza7IqxpSZApf98agKhPWhNsmsNbQJNxdLsCq1D9icFyr jRX36LkEzsCDwHefu1lPCow+sB/frzo9kWqbKkm0sEvGN7d2/v1Z1k0C3s/fPYTP7YVJ 8ragu3mmAsvfNtXwuEkqCY/P6wWcN5QGx0JWZvh127jX8mf2AffMZ2YAIoVQla5ZCF8e KmMu2RYBepWR/lR+JdTILXCB4iK7qs8je70sVy7LWnEDLSoNEBfsFlJnBD9kaUKAlFTK oafg== X-Gm-Message-State: APjAAAXB1Gk4Y3pHpYfiZV++krD1Axbyv2N6yrpnt5E7Oy52VCah8nJV 0gMr9yhmjMGACOKpIVWvNPSPVgNjcnsEM60ImMOk6g== X-Received: by 2002:ac8:2692:: with SMTP id 18mr459611qto.343.1553009787535; Tue, 19 Mar 2019 08:36:27 -0700 (PDT) MIME-Version: 1.0 References: <1552997064-432700-1-git-send-email-dragan.cvetic@xilinx.com> <1552997064-432700-5-git-send-email-dragan.cvetic@xilinx.com> In-Reply-To: From: Arnd Bergmann Date: Tue, 19 Mar 2019 16:36:08 +0100 Message-ID: Subject: Re: [PATCH 04/12] misc: xilinx_sdfec: Add open, close and ioctl To: Dragan Cvetic Cc: gregkh , Michal Simek , Linux ARM , Derek Kiernan , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Mar 19, 2019 at 3:59 PM Dragan Cvetic wrote: > > > > > + /* Only one open per device at a time */ > > > + if (!atomic_dec_and_test(&xsdfec->open_count)) { > > > + atomic_inc(&xsdfec->open_count); > > > + return -EBUSY; > > > + } > > > > What is that limitation for? Is it worse to open it twice than > > to dup() or fork()? > > > The device can be opened only once. What I mean here is that preventing the double open() is a fairly weak protection: it means you cannot have multiple 'struct file' pointers attached to the same inode, but you can still have the same 'struct file' being available to multiple processes. Arnd