From patchwork Wed Sep 4 09:31:40 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 19748 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ve0-f200.google.com (mail-ve0-f200.google.com [209.85.128.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 7BD9524869 for ; Wed, 4 Sep 2013 09:32:07 +0000 (UTC) Received: by mail-ve0-f200.google.com with SMTP id oz10sf45486veb.11 for ; Wed, 04 Sep 2013 02:32:07 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=mime-version:x-gm-message-state:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=GW+3Re+Yaos6FA+JDQkbpok+ewCRMAy5c4B8uwV+s1A=; b=Qb/CAEP3lJXw7YgwuPjEj9sbxIu1ppUZTatY5klRJlwYwxIHcP082wax6/q99DC6x7 LVO0YYq+rUlC8Ekwk6XC4AJy79ScX07IFtbXOYlhupdySARxZnFik2SGr/AZeOPvSS1K RojlSE2zvpTjC7E3H8FAKScbFzKdraWJ8EnUuJlivvmJxtlwafZ0wtW1lNBBknpAi153 VT3eMQnSDsMJYJY7gTtqCag4FezMF4oAQJOGIRiV78xZB9J6kVHiOeEQOr1yR4uHE84V IQP297Wy/el9O19gSxmwyylJCFwyFlmNena5Tan9qXkESnGwgc7lUm0UayO/wx1U/J4w LEIw== X-Received: by 10.224.36.198 with SMTP id u6mr2110555qad.6.1378287127352; Wed, 04 Sep 2013 02:32:07 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.25.227 with SMTP id f3ls54200qeg.40.gmail; Wed, 04 Sep 2013 02:32:07 -0700 (PDT) X-Received: by 10.52.230.233 with SMTP id tb9mr1488940vdc.17.1378287127229; Wed, 04 Sep 2013 02:32:07 -0700 (PDT) Received: from mail-vc0-f175.google.com (mail-vc0-f175.google.com [209.85.220.175]) by mx.google.com with ESMTPS id p7si4156769vdv.16.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 04 Sep 2013 02:32:07 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.220.175 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.220.175; Received: by mail-vc0-f175.google.com with SMTP id ia10so38998vcb.6 for ; Wed, 04 Sep 2013 02:32:07 -0700 (PDT) X-Gm-Message-State: ALoCoQki3zSbGBukBf2l8nTMA4oRAw+eLdB1XcmQb8ksXTcD2LkCCGvleIDbqZzKXUZ7I0cfevtk X-Received: by 10.220.46.72 with SMTP id i8mr1835233vcf.10.1378287127128; Wed, 04 Sep 2013 02:32:07 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.220.174.196 with SMTP id u4csp223888vcz; Wed, 4 Sep 2013 02:32:06 -0700 (PDT) X-Received: by 10.14.3.9 with SMTP id 9mr1318854eeg.72.1378287126075; Wed, 04 Sep 2013 02:32:06 -0700 (PDT) Received: from mail-ee0-f49.google.com (mail-ee0-f49.google.com [74.125.83.49]) by mx.google.com with ESMTPS id z8si18367322eee.83.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 04 Sep 2013 02:32:06 -0700 (PDT) Received-SPF: neutral (google.com: 74.125.83.49 is neither permitted nor denied by best guess record for domain of lee.jones@linaro.org) client-ip=74.125.83.49; Received: by mail-ee0-f49.google.com with SMTP id d41so34498eek.22 for ; Wed, 04 Sep 2013 02:32:05 -0700 (PDT) X-Received: by 10.14.178.66 with SMTP id e42mr1302310eem.67.1378287125475; Wed, 04 Sep 2013 02:32:05 -0700 (PDT) Received: from localhost.localdomain (cpc15-aztw25-2-0-cust493.aztw.cable.virginmedia.com. [92.233.57.238]) by mx.google.com with ESMTPSA id p5sm38475700eeg.5.1969.12.31.16.00.00 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 04 Sep 2013 02:32:04 -0700 (PDT) From: Lee Jones To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, jic23@cam.ac.uk Cc: arnd@arndb.de, linus.walleij@linaro.org, denis.ciocca@st.com, linux-iio@vger.kernel.org, Lee Jones Subject: [PATCH 08/11] iio: pressure-core: st: Allow for number of channels to vary Date: Wed, 4 Sep 2013 10:31:40 +0100 Message-Id: <1378287103-21765-9-git-send-email-lee.jones@linaro.org> X-Mailer: git-send-email 1.8.1.2 In-Reply-To: <1378287103-21765-1-git-send-email-lee.jones@linaro.org> References: <1378287103-21765-1-git-send-email-lee.jones@linaro.org> X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: lee.jones@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.220.175 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , At the moment the number of channels specified is dictated by the first sensor supported by the driver. As we add support for more sensors this is likely to vary. Instead of using the ARRAY_SIZE() of the LPS331AP's channel specifier we'll use a new adaptable 'struct st_sensors' element instead. Signed-off-by: Lee Jones --- drivers/iio/pressure/st_pressure_core.c | 3 ++- include/linux/iio/common/st_sensors.h | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/iio/pressure/st_pressure_core.c b/drivers/iio/pressure/st_pressure_core.c index 423ed6a..3cf54ed 100644 --- a/drivers/iio/pressure/st_pressure_core.c +++ b/drivers/iio/pressure/st_pressure_core.c @@ -101,6 +101,7 @@ static const struct st_sensors st_press_sensors[] = { [0] = LPS331AP_PRESS_DEV_NAME, }, .ch = (struct iio_chan_spec *)st_press_lsp331ap_channels, + .num_ch = ARRAY_SIZE(st_press_lsp331ap_channels), .odr = { .addr = ST_PRESS_LPS331AP_ODR_ADDR, .mask = ST_PRESS_LPS331AP_ODR_MASK, @@ -237,7 +238,7 @@ int st_press_common_probe(struct iio_dev *indio_dev) pdata->num_data_channels = ST_PRESS_NUMBER_DATA_CHANNELS; pdata->multiread_bit = pdata->sensor->multi_read_bit; indio_dev->channels = pdata->sensor->ch; - indio_dev->num_channels = ARRAY_SIZE(st_press_lsp331ap_channels); + indio_dev->num_channels = pdata->sensor->num_ch; if (pdata->sensor->fs.addr != 0) pdata->current_fullscale = (struct st_sensor_fullscale_avl *) diff --git a/include/linux/iio/common/st_sensors.h b/include/linux/iio/common/st_sensors.h index 72b2694..4aef925 100644 --- a/include/linux/iio/common/st_sensors.h +++ b/include/linux/iio/common/st_sensors.h @@ -180,6 +180,7 @@ struct st_sensors { u8 wai; char sensors_supported[ST_SENSORS_MAX_4WAI][ST_SENSORS_MAX_NAME]; struct iio_chan_spec *ch; + int num_ch; struct st_sensor_odr odr; struct st_sensor_power pw; struct st_sensor_axis enable_axis;