Received: by 2002:a25:ef43:0:0:0:0:0 with SMTP id w3csp1944776ybm; Sun, 31 May 2020 03:37:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyn5BGq9+7nwZDTUgZHemqGT4fAUYppbAohGbC6bZEr7cO4SecNFxR6IyzxQOpHbQPiBWi9 X-Received: by 2002:a50:99c9:: with SMTP id n9mr16943250edb.1.1590921471849; Sun, 31 May 2020 03:37:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590921471; cv=none; d=google.com; s=arc-20160816; b=yRPy3aB7HBIQR31ZLbeJzStDnUp76jkR5qqxWrpgc/faciVxWH6NPOA8I/Oo1chKrs 6CTBxxwrYov1ZiRMWEKJ0iptRVN3EYK6KabZGTfzAyCYZzlmzVTOSjJ3Rst9cQnUhxZZ De5gzUIyIDNoY8tK39OzvK8LbCE5On05XCCfrMemollMfAaiFo9afU6QINp7nRs5hLVG /latmVMCIHkFN3fnjy999d0ABSsPo5rhSp+3LGEQav6DwMxTJarIg3JKFdZQFvlwWT1A J03fM9zMTzr2NgaOob+j/iZZ8uqbY3pV8lzWB98ibfDdm4rYrHLq8Uv4kO1NO8GM3SgB zZIw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=7xsFTGEDH8lFoKutYq1tPdDQ1qaShPK257+O85vZhCo=; b=u3fsAWXg31q7fKZLVKi5n7/cIyWYOn49lG0fbXVLV1NAPRFmv613JIqS7Z5gr1IoFI jMAa00H8YGXF8DtXQFiSTz3ftdhgIx/pmImDnUZZC2oOZt4aAcdAmo6zrKc1O3sEFkJ6 lEOtYrkRQaNlL4Y+elV8dFPjQ3cfVoR1HlSdC1l5uvSuzLD1gPpx8aqCt5bHcEQyVrha 8pCZ9uF6tpxJTt2Bnt/KsCtkL6WHwejM1uXA5YRcB7f5g3CH/TamqHELvr08rwj/IOil 1t35ixZ0xugQYZyC/kHiNRgjRR0t5c/xs/OSKHdTc2LdvoM29M6d9AitfakvAfQsbhOc XBkQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=igluf4Z+; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d13si8661902ejj.191.2020.05.31.03.37.29; Sun, 31 May 2020 03:37:51 -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=@kernel.org header.s=default header.b=igluf4Z+; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728222AbgEaKQ0 (ORCPT + 99 others); Sun, 31 May 2020 06:16:26 -0400 Received: from mail.kernel.org ([198.145.29.99]:47272 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725813AbgEaKQZ (ORCPT ); Sun, 31 May 2020 06:16:25 -0400 Received: from archlinux (cpc149474-cmbg20-2-0-cust94.5-4.cable.virginm.net [82.4.196.95]) (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 D6F8120707; Sun, 31 May 2020 10:16:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1590920185; bh=nbhATkfY1Uk+aTiFvmH+nFFiyv7NRdgxPRwZRVWZmsQ=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=igluf4Z+4F7b0f2oe2kF1N3eTtGvXebXFRnyz6kjj9tf96/YfE0OAnM6RLXnLq0oD cFNnSZjzF8JubdvS030sxvnhC+g4mhkDUixT9nIOtM1JMOdzDGRXTvnyNtGzzn1FxV zAxErYMLGWnsoIR/8nJ3/xnCLyfLQfSd8f/FlNtY= Date: Sun, 31 May 2020 11:16:21 +0100 From: Jonathan Cameron To: Tomasz Duszynski Cc: , , , , , Subject: Re: [PATCH v2 1/4] iio: chemical: scd30: add core driver Message-ID: <20200531111621.034cf3cd@archlinux> In-Reply-To: <20200531105840.27e17f3d@archlinux> References: <20200530213630.87159-1-tomasz.duszynski@octakon.com> <20200530213630.87159-2-tomasz.duszynski@octakon.com> <20200531105840.27e17f3d@archlinux> X-Mailer: Claws Mail 3.17.5 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, 31 May 2020 10:58:40 +0100 Jonathan Cameron wrote: > On Sat, 30 May 2020 23:36:27 +0200 > Tomasz Duszynski wrote: > > > Add Sensirion SCD30 carbon dioxide core driver. > > > > Signed-off-by: Tomasz Duszynski > > Hi Tomasz > > A few things inline. Includes the alignment issue on > x86_32 that I fell into whilst trying to fix timestamp > alignment issues. Suggested resolution inline for that. > > Thanks, > > Jonathan > Update below after looking at the way this works with the serial dev. > > +int scd30_probe(struct device *dev, int irq, const char *name, void *priv, > > + scd30_command_t command) > > +{ > > + static const unsigned long scd30_scan_masks[] = { 0x07, 0x00 }; > > + struct scd30_state *state; > > + struct iio_dev *indio_dev; > > + int ret; > > + u16 val; > > + > > + indio_dev = devm_iio_device_alloc(dev, sizeof(*state)); > > + if (!indio_dev) > > + return -ENOMEM; > > + > > + state = iio_priv(indio_dev); > > + state->dev = dev; > > Doesn't seem to be used. > > > + state->priv = priv; > > What's this for? At least at first glance I can't find it being used > anywhere. Ah. Used in the serial module. Maybe add a comment to the structure definition about that. As is the dev etc. Is it possible to use the > > > + state->irq = irq; > > + state->pressure_comp = SCD30_PRESSURE_COMP_DEFAULT; > > + state->meas_interval = SCD30_MEAS_INTERVAL_DEFAULT; > > + state->command = command; > > + mutex_init(&state->lock); > > + init_completion(&state->meas_ready); > > + > > + dev_set_drvdata(dev, indio_dev); > > + > > + indio_dev->dev.parent = dev; > > Side note that there is a series moving this into the core under revision at > the moment. Hopefully I'll remember to fix this up when applying your patch > if that one has gone in ahead of it. > > > + indio_dev->info = &scd30_info; > > + indio_dev->name = name; > > + indio_dev->channels = scd30_channels; > > + indio_dev->num_channels = ARRAY_SIZE(scd30_channels); > > + indio_dev->modes = INDIO_DIRECT_MODE; > > + indio_dev->available_scan_masks = scd30_scan_masks; > > + > > + state->vdd = devm_regulator_get(dev, "vdd"); > > + if (IS_ERR(state->vdd)) { > > + if (PTR_ERR(state->vdd) == -EPROBE_DEFER) > > + return -EPROBE_DEFER; > > + > > + dev_err(dev, "failed to get regulator\n"); > > + return PTR_ERR(state->vdd); > > + } > > + > > + ret = regulator_enable(state->vdd); > > + if (ret) > > + return ret; > > + > > + ret = devm_add_action_or_reset(dev, scd30_disable_regulator, state); > > + if (ret) > > + return ret; > > + ...