Received: by 10.192.165.148 with SMTP id m20csp631995imm; Wed, 25 Apr 2018 05:26:18 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpRPybYrfOlpnZSxvEJ7NT4CPljUWaSuHFzimS6J3b0KePlhEppvvcRv8ivF77Xt7/cDwx2 X-Received: by 10.101.102.86 with SMTP id z22mr913244pgv.31.1524659178162; Wed, 25 Apr 2018 05:26:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524659178; cv=none; d=google.com; s=arc-20160816; b=xYgbc3aOEFFmj6MZYkpIz3TxTlsp4u9Vu4jaTZJOW7hpcbV43Sx/oj9ZjqY3SP2r2c +D6oc6DqVV2PEOKApWu6MnQ8L4i1RNKP0k+89mOYTkTY02a00YdZa2jq343d12Beegc8 pkJm3uTg4Wa5SPTU19Vyk9ofkAFt7ei5ie/DTEp0wK900R8TRjrCAYvQBU4IkeQtBsuf x6KJC4tMDZdTUpqy8XrQT+M+nqI634HZGCnMlOY6+hp+5ktcKC4tGzaUN50B64m8PF3a 5Q1OdnoPtGtjBI46AfMFWWsnccm3g+GoJ+ZTcuBRHQpr5nJh6arETftysdcudJXau/iQ 8rfg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=0ysj9hHxVgpLfRa8J/18kF7+d5TSzpOhYGgrSmwERy8=; b=o/UZm7DxqKMZK45Wgu7FBBXbNu7kk3zjZT+TEM/pRZj8EYtW7V3qRDx+Adu3cIqh1G MToH/ImTjESjSTVR2Z2CMVB3bjRcG8jCWAuE92WbzaMMth3NAfzjbdhWDXPRSuCqGHDm TUvhX4EAGdL6PJ0iRcq0D4dr2f4xzSPpQr8LMcWtY1d+pza0TbaKTJSeJlT+ViosJpXi qXLca+o1siLI5HGJI8QHEWEd4kmuvxIuVZRN9dHD2vmbX5/UK0pDwnCmbwtgYOxKe6pE qNEHSt9ErMu1xH6r5nkBlcvxxmmfJTAKVQ9MIB7FupHVFdVVhIsumudLPEkFXDtqGYjO ZQSA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=JlB7lYhm; 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 j61-v6si16023390plb.317.2018.04.25.05.26.03; Wed, 25 Apr 2018 05:26:18 -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; dkim=fail header.i=@gmail.com header.s=20161025 header.b=JlB7lYhm; 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 S1753946AbeDYMXa (ORCPT + 99 others); Wed, 25 Apr 2018 08:23:30 -0400 Received: from mail-lf0-f68.google.com ([209.85.215.68]:33270 "EHLO mail-lf0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751870AbeDYMX0 (ORCPT ); Wed, 25 Apr 2018 08:23:26 -0400 Received: by mail-lf0-f68.google.com with SMTP id m18-v6so7861372lfb.0; Wed, 25 Apr 2018 05:23:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=0ysj9hHxVgpLfRa8J/18kF7+d5TSzpOhYGgrSmwERy8=; b=JlB7lYhmJEEwCZc/Ei4xbvh/iv2u9LUquzR5pjmBC4Ftp1+LA21R68IP9BTRx9tHDK eZJ5dmSuKqOi3Ex1/CHpW+EITM3q7QXtyWARQCg+v05wRUThh7j9rUQUd0v5XTR0CXP0 VUIAeJYHU9S+3gyevJJvo1Ge1KegmMOU9lH8xIisfhK4a8375kSyrTMkMRjlKOnAfwnW Qzkx19Bw0VI0fknQpwXYcSZ5Aa2j1Z8sk2NNBZwWeM8uINqlaCAyVp1WqC5d03+C/JSK b438DhZ3wOc0lXjs13LISO0Jzsn4LHplkCCZC+tKJ4Kw6qTBpPh0jBhIQoAtjvWn+VHN zzhw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to:user-agent; bh=0ysj9hHxVgpLfRa8J/18kF7+d5TSzpOhYGgrSmwERy8=; b=RningL47tAl1Ri3lQuwrehhJD5BgGy/SrDm1KRzFwg8OwlM9PfxsKrsdqSZie6Fw6T AjzLyeVqWNkqg7bxam3IkdrTwJfkRU5pS+MZaeYNl9B9QqwFkdYq7QN1/DqFIWi1KeUs a+NfL5yYzHDIzMF4uOMLWrJ5LodWZFMna+9rOqxrfTZKcdqyDIBjudHSVknTP/BjDBcD z6hPhwB0vgCDuwJm6JyIspqWYiTorbxevzHSDcsIFKl5YWrTi7JE++M4vyM4AwJhNxH0 eMD/q21F5mbHvgAxhlLYggOwVV4RUpgJf6h0MsXRN9edQzeq8PUcurDtGlkFr0DcbsHN pWGw== X-Gm-Message-State: ALQs6tCP/S/L0206iccIb9H5Ynbqq2LlBbsJB7ulgUocVLP4OQs6u0zl nRrWa01mKMB0h3FeffOi2+8= X-Received: by 10.46.134.136 with SMTP id l8mr20287966lji.116.1524659004065; Wed, 25 Apr 2018 05:23:24 -0700 (PDT) Received: from xi.terra (c-8bb2e655.07-184-6d6c6d4.cust.bredbandsbolaget.se. [85.230.178.139]) by smtp.gmail.com with ESMTPSA id y1-v6sm3921589lfg.88.2018.04.25.05.23.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 25 Apr 2018 05:23:23 -0700 (PDT) Received: from johan by xi.terra with local (Exim 4.90_1) (envelope-from ) id 1fBJS7-0000J5-TQ; Wed, 25 Apr 2018 14:23:15 +0200 Date: Wed, 25 Apr 2018 14:23:15 +0200 From: Johan Hovold To: Greg Kroah-Hartman Cc: Johan Hovold , Rob Herring , Mark Rutland , Andreas Kemnade , Arnd Bergmann , "H . Nikolaus Schaller" , Pavel Machek , linux-kernel@vger.kernel.org, devicetree@vger.kernel.org Subject: Re: [PATCH 1/7] gnss: add GNSS receiver subsystem Message-ID: <20180425122315.GS4615@localhost> References: <20180424163458.11947-1-johan@kernel.org> <20180424163458.11947-2-johan@kernel.org> <20180425085649.GB13295@kroah.com> <20180425105645.GP4615@localhost> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180425105645.GP4615@localhost> User-Agent: Mutt/1.9.5 (2018-04-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Apr 25, 2018 at 12:56:45PM +0200, Johan Hovold wrote: > On Wed, Apr 25, 2018 at 10:56:49AM +0200, Greg Kroah-Hartman wrote: > > On Tue, Apr 24, 2018 at 06:34:52PM +0200, Johan Hovold wrote: > > > +static int gnss_open(struct inode *inode, struct file *file) > > > +{ > > > + struct gnss_device *gdev; > > > + int ret = 0; > > > + > > > + gdev = container_of(inode->i_cdev, struct gnss_device, cdev); > > > + > > > + get_device(&gdev->dev); > > > + > > > + nonseekable_open(inode, file); > > > + file->private_data = gdev; > > > + > > > + down_write(&gdev->rwsem); > > > > Just curious, why a rwsem? They can be slower than a normal semaphore, > > is this really a contentious lock? > > I use the rwsem to deal with hotplugging; the underlying device can go > away at any time and the core makes sure that no further calls into the > corresponding driver is made once all currently executing callbacks > return. I just did find one access to the gnss ops which was unsafe however; the existence check for a write_raw callback in write() needs to be replaced by a device flag. Thanks, Johan