Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751760AbbKJVpU (ORCPT ); Tue, 10 Nov 2015 16:45:20 -0500 Received: from mx1.redhat.com ([209.132.183.28]:41331 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751059AbbKJVpS (ORCPT ); Tue, 10 Nov 2015 16:45:18 -0500 From: Jeff Moyer To: Jerry.Hoemann@hpe.com Cc: ross.zwisler@linux.intel.com, rjw@rjwysocki.net, lenb@kernel.org, dan.j.williams@intel.com, linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, linux-nvdimm@ml01.01.org Subject: Re: [PATCH 3/4] nvdimm: Add IOCTL pass thru References: <2792786733bc18d561ca352d7a642b3989a370fa.1446684001.git.jerry.hoemann@hpe.com> <20151110213613.GC47666@tevye.fc.hp.com> X-PGP-KeyID: 1F78E1B4 X-PGP-CertKey: F6FE 280D 8293 F72C 65FD 5A58 1FF8 A7CA 1F78 E1B4 X-PCLoadLetter: What the f**k does that mean? Date: Tue, 10 Nov 2015 16:45:16 -0500 In-Reply-To: <20151110213613.GC47666@tevye.fc.hp.com> (Jerry Hoemann's message of "Tue, 10 Nov 2015 14:36:13 -0700") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1432 Lines: 38 Jerry Hoemann writes: > On Tue, Nov 10, 2015 at 11:24:47AM -0500, Jeff Moyer wrote: >> Jerry Hoemann writes: >> >> > @@ -633,10 +718,11 @@ static int match_dimm(struct device *dev, void *data) >> > >> > static long nvdimm_ioctl(struct file *file, unsigned int cmd, unsigned long arg) >> > { >> > - int rc = -ENXIO, read_only; >> > + int rc = -ENXIO, ro; >> > struct nvdimm_bus *nvdimm_bus; >> > + unsigned int type = _IOC_TYPE(cmd); >> > >> > - read_only = (O_RDWR != (file->f_flags & O_ACCMODE)); >> > + ro = (O_RDWR != (file->f_flags & O_ACCMODE)); >> >> I'm still reviewing the rest of this, but this is bugging me. The >> existing check for read_only looks pretty fishy to me. O_WRONLY is a >> thing (even though it's probably not a supportable mode for this ioctl). >> Why not just check for O_RDONLY? > > > Good question. I'll look into changing for version 2. > I suspect you would like something more like: > > ro = ((file->f_flags & O_ACCMODE) == O_RDONLY); Yeah. I'd make that a separate patch, and put it first in the series since it's a cleanup than can be applied to older kernels if necessary. Thanks, Jeff -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/