Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp725964pxj; Thu, 13 May 2021 15:39:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw/usTo72zlqWBi/EzoQjJ/Xv6yC//frTPTVfj0vGWEiG3yYgq1v01nfJBZwLnWzgL6KZCy X-Received: by 2002:a17:906:170d:: with SMTP id c13mr44710397eje.491.1620945560175; Thu, 13 May 2021 15:39:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620945560; cv=none; d=google.com; s=arc-20160816; b=UfkccVSocF2Hso+0uD7ZgxaOPg5blq4N5h319DuoJXRqvCxkIQqGS9bZoMTP4/U/3m uzp1FL8S/epE3rX3nRKFCVolwMqS++7jmuABw2vMmB4Amke9WPi8xVaPFZv62XWC9sQE 89NFEyXn0UsXGzcIZBUt1pFZVVXo6PYeEfFRVTecNk+kdd1Bq/cC/QnOSU0ifHQUVyrR B8SBZ7iZMCR8dVm/nHv2uDgGtZHsxHnxJAsv8lchZGGovWPTzz9DZgBg9a/bKv3zSd7N 3nGEL78jBZ+9Nr9JgXviPEnNHvYakj/vHqUznEfSnr3HIXrtGKSaP+VoEx9us5dNx03p lvHA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:in-reply-to:subject :cc:to:from:user-agent:references:ironport-sdr:ironport-sdr; bh=rkEGqDEzkayqglq9gwYjwymmxr9RQ7ohcYBhrMHm2ko=; b=VzjJX8Tm8I3CRp2EReaDL1QXwqMdpI0q24sPeOSsigcUN41Rp7aMtxv1KZci6qvlWy 5lUD/Fc3W1Nbfm0BbpiDC7oHiAzqywaswSi0qkmdVyG95eFHn+TdvDAHEeeIXMoQnuyc KdGgFwNn02QrEqld+21eyS5XqmNj2IS33PREfRc64WnsL579F5vFf56+iC0zlsOC0yU4 Br/rsd00tJT07HJQ3Xsy7H5qp0B1oz7dWal9h+Rs4LopJ5aTCwI0kQFEbBNo9CleaiGh Kswh9k2vvaDRTCEJqgalFDp1JJ5byv5L+yZxdb8hOz9rO+dRa7QzyNddi9nJT2KDdObC kK+Q== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b1si5048807ejb.448.2021.05.13.15.38.56; Thu, 13 May 2021 15:39:20 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230088AbhEMRKU (ORCPT + 99 others); Thu, 13 May 2021 13:10:20 -0400 Received: from mga05.intel.com ([192.55.52.43]:41146 "EHLO mga05.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229906AbhEMRKT (ORCPT ); Thu, 13 May 2021 13:10:19 -0400 IronPort-SDR: HjyYSErb/UN5phqlqCNm0JO3Yp7i+x/otmb1PcH5Mlt1wRwkJ7xJ6k4TjXEu0vnBNSSo5gaqqJ N6rWlx1XjbpQ== X-IronPort-AV: E=McAfee;i="6200,9189,9983"; a="285503925" X-IronPort-AV: E=Sophos;i="5.82,296,1613462400"; d="scan'208";a="285503925" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 May 2021 10:06:22 -0700 IronPort-SDR: STnDbgJ5e1/EV9FwXRDSk2rhqhGIUjO3A+kFrPQAukeCA1MYQe7kafsPMf9QsE7mdEGw4jPE8l gOgUgVhS2zVA== X-IronPort-AV: E=Sophos;i="5.82,296,1613462400"; d="scan'208";a="626308346" Received: from gna-dev.igk.intel.com (HELO localhost) ([10.102.80.34]) by fmsmga005-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 May 2021 10:06:20 -0700 References: <20210513110040.2268-1-maciej.kwapulinski@linux.intel.com> <20210513110040.2268-13-maciej.kwapulinski@linux.intel.com> User-agent: mu4e 1.4.13; emacs 26.3 From: Maciej Kwapulinski To: Greg Kroah-Hartman 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 In-reply-to: Date: Thu, 13 May 2021 19:06:18 +0200 Message-ID: <85r1iaimwl.fsf@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Greg Kroah-Hartman writes: > 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? next patch provides complete implementation of gna_open(), here it's just a protection if someone would incidentally run gna in the middle of patch series > >> + >> +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 *? it goes to devm_add_action() api. > > 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? I'd like to avoid having gna_probe's fail path at all. > > > thanks, > > greg k-h