Received: by 10.192.165.148 with SMTP id m20csp3044855imm; Sun, 29 Apr 2018 12:41:55 -0700 (PDT) X-Google-Smtp-Source: AB8JxZqQidI9JxZd/4vnGfKMJuOLD9dbN7XfZLXfKYNe8rCt49I6Xu+9PBAgoeqf6gQfw4jmHkt1 X-Received: by 10.98.245.91 with SMTP id n88mr1926892pfh.208.1525030915022; Sun, 29 Apr 2018 12:41:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525030914; cv=none; d=google.com; s=arc-20160816; b=MJ7MC3JTSb5qqzocCfY+wlyUmTXTrI0gsT8itH4NlqurRZZNBL2/V66xS2Zeazp/9o f0ExE42XFi89usziZQuscAxAE+yq3sR2RtQYlYDCkZuPcWasAVYWIrw1ItiNHkXcy5fm fdwZnOkDEMEYV/p7qLBgd2y6JBr/YXKZyDILGeLWwdLVGMWon4trVZ1cfY2eMQnkoS5z PPguGvtn8JZIAFy5+o6GmyP4kWAV/5yGMSkk3OgYHhlWB7aqpVAPgJgwa1dWdukLaMiZ 86R8lUIDbwMNcAPkz7WylNlMeVbG4VKVtnVE0D3yHAMwm8LcWxjCgfJfZnc9KnTD8Aub rc7w== 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:dmarc-filter:arc-authentication-results; bh=oINmiFS6k3y0CBWfF8DlhMjBHfQC0mqsoRDexPLnZ4I=; b=DHruikSGOvTBW3wVQgBdf0jMqsR0eKoqRNv85gQbSWM0H4IfZJ3nLraEjMZhGz1JwZ FeoQh62rnnE2r/ep27WUTinP7qSuBLTM1ZfeSlcLZy1emxFe9ltDDC20Ecl2NdwnAPxg kn7fpviuWKXrRz/IGcpgPl7RnbJGymFrUUDRq8T+MHstmzZzqlXhOVBmlVVF1pJtnNsp CM0nKyPxqkoQJlkggftKGYEf9AvY0J66HSwaHydSQihI8QVxDRyrPFZJdxDzPnztXd2i 6aO1jmDIswYW/8yzk7Lis2vq5sK+RXGudBcpGBCUAdVio18GM9pSj6bMmT+EWHOzHZ3z EWwQ== 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 u47-v6si5200273pgn.488.2018.04.29.12.41.41; Sun, 29 Apr 2018 12:41:54 -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 S1754274AbeD2Tkh (ORCPT + 99 others); Sun, 29 Apr 2018 15:40:37 -0400 Received: from mail.kernel.org ([198.145.29.99]:42554 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754243AbeD2Tk3 (ORCPT ); Sun, 29 Apr 2018 15:40:29 -0400 Received: from localhost (mobile-166-137-179-035.mycingular.net [166.137.179.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 905F9229EC; Sun, 29 Apr 2018 19:40:26 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 905F9229EC Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=linuxfoundation.org Authentication-Results: mail.kernel.org; spf=fail smtp.mailfrom=gregkh@linuxfoundation.org Date: Sun, 29 Apr 2018 15:35:11 +0200 From: Greg Kroah-Hartman To: Johan Hovold Cc: 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: <20180429133511.GA28913@kroah.com> References: <20180424163458.11947-1-johan@kernel.org> <20180424163458.11947-2-johan@kernel.org> <20180425085649.GB13295@kroah.com> <20180425105645.GP4615@localhost> <20180425122315.GS4615@localhost> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180425122315.GS4615@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 02:23:15PM +0200, Johan Hovold wrote: > 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. Ok, in looking at this closer, it makes more sense to me, and my worries are not true, you are handling this properly, sorry for the noise. I'll wait for the next resend of this series to review it again and consider merging it. thanks, greg k-h