Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp547134pxj; Thu, 13 May 2021 10:54:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxRbNTlOkOSQReMxyQOwM2alcMaaAJwa+scSLreDablJVVyGJ5DV769W+WrRuh5oo4Z4Nuv X-Received: by 2002:aca:d417:: with SMTP id l23mr31475552oig.97.1620928490941; Thu, 13 May 2021 10:54:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620928490; cv=none; d=google.com; s=arc-20160816; b=MGOwS9uKQB6eSZX7Z91k/bzSIKPH+AAYQ5UNnyNVhnrwP+grWUa2W7MEuQ7QDPkxyF JCm5Kf+BRInxYkPttk8KO+YnrKp3M4h8wYWWChhT0nog9lgWAGxd920SipvHdFRQ8tEW qhT8Wr8/eLl4AO/ATNdHjFHYuLzGDa5SCtOCkslZ91LVCzFJAexw5TcQAZt0p1zYEWC2 Au4jldahg6D+V8nStzv1z86w9BvwsUbCYajaZp3r2IqkOX1tC4L3pn2iaBkIWtjt1Sbf PW7TAxGeM3dhbJjBz2oHZfIxERnMwG4AIfkUYW5VA2eZkS3Kch9meiFCcttIsn7oUe4B zqsA== 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=SK8/0KQDWB4Wcs3A9rVrcNaLVgUPVIjX6C/Qk8m/yeI=; b=nhds/Ij3yfamKXS27kXK8hVBrd8VSvrXeLqKrOJcBDZQr81EAI51Q8O3JIElGLyFFe UrzAcU+CtMiKaDPDV65bMBZSE3b5JWywq21qtdIC8jKe0HQ6L6ZQkY2xeAfkWg4WnOFy DB3E+5jkRxwBISIadX5Cx/VPa4kNS+tayl/ThZjt7Gh9Umly4cQfma97n5e05iXqtrIW 49Kk63bqUTx14T/ddiWCd93VQpNHlgfAS3Yc+QgxuhIEabGPUKnqT4UnoOxMRZscOLSy ewIyWXr05bbvgrj/FC34vgcpy86xzV/m02ycnZQ4c5XPhZmEOo8ZI2q2ePrZ4gwsGkir lV3Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=VYkobjBN; 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 g2si3930692oti.323.2021.05.13.10.54.36; Thu, 13 May 2021 10:54:50 -0700 (PDT) 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=VYkobjBN; 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 S230445AbhEMLTg (ORCPT + 99 others); Thu, 13 May 2021 07:19:36 -0400 Received: from mail.kernel.org ([198.145.29.99]:36354 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233342AbhEMLTS (ORCPT ); Thu, 13 May 2021 07:19:18 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 6730D613D6; Thu, 13 May 2021 11:18:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1620904687; bh=fJ1K6OK2GLOTGB4kKNjzkYtLV2Dyx0X/T8PFP6DCmZc=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=VYkobjBNhi7rzPAOQGhKrsWcKLVi0shW1XHL7ya3DeTl7Lm6xLvhb7m+DXTGwh7vr M8BY4HCKbS3TUZUyl1qn1ULPBoBuvnFx32kNc7JTJQ9Q8kBR6roR5dldP9yZZNniez gqOHpYc2keAd30ZdXKIR4itM2CpNzUvG16sjh/hs= Date: Thu, 13 May 2021 13:18:05 +0200 From: Greg Kroah-Hartman To: Maciej Kwapulinski Cc: Arnd Bergmann , Jonathan Corbet , Derek Kiernan , Dragan Cvetic , Andy Shevchenko , linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, Savo Novakovic Subject: Re: [PATCH v3 12/14] intel_gna: add a 'misc' device Message-ID: References: <20210513110040.2268-1-maciej.kwapulinski@linux.intel.com> <20210513110040.2268-13-maciej.kwapulinski@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210513110040.2268-13-maciej.kwapulinski@linux.intel.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, May 13, 2021 at 01:00:38PM +0200, Maciej Kwapulinski wrote: > The new 'misc' device is the node for applications in user space to > interact with the driver. > > Signed-off-by: Maciej Kwapulinski > Tested-by: Savo Novakovic > --- > drivers/misc/intel/gna/device.c | 52 +++++++++++++++++++++++++++++++-- > drivers/misc/intel/gna/device.h | 11 +++---- > 2 files changed, 55 insertions(+), 8 deletions(-) > > diff --git a/drivers/misc/intel/gna/device.c b/drivers/misc/intel/gna/device.c > index 0e31b8c6bb70..1e6345a8325b 100644 > --- a/drivers/misc/intel/gna/device.c > +++ b/drivers/misc/intel/gna/device.c > @@ -20,6 +20,18 @@ module_param(recovery_timeout, int, 0644); > MODULE_PARM_DESC(recovery_timeout, "Recovery timeout in seconds"); > #endif > > +struct file; > + > +static int gna_open(struct inode *inode, struct file *f) > +{ > + return -EPERM; > +} That sucks, why have an open that does nothing but fail? > + > +static const struct file_operations gna_file_ops = { > + .owner = THIS_MODULE, > + .open = gna_open, > +}; > + > static void gna_devm_idr_destroy(void *data) > { > struct idr *idr = data; > @@ -27,6 +39,36 @@ static void gna_devm_idr_destroy(void *data) > idr_destroy(idr); > } > > +static void gna_devm_deregister_misc_dev(void *data) Why is this a void *? This isn't windows, use real pointer types everywhere in the kernel please. > +{ > + struct miscdevice *misc = data; > + > + misc_deregister(misc); > +} > + > +static int gna_devm_register_misc_dev(struct device *parent, struct miscdevice *misc) > +{ > + int ret; > + > + ret = misc_register(misc); > + if (ret) { > + dev_err(parent, "misc device %s registering failed. errcode: %d\n", > + misc->name, ret); > + gna_devm_deregister_misc_dev(misc); > + } else { > + dev_dbg(parent, "device: %s registered\n", > + misc->name); You have loads of debugging in this driver still, is it really needed? > + } > + > + ret = devm_add_action(parent, gna_devm_deregister_misc_dev, misc); Why do you need this? thanks, greg k-h