Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp3004190imm; Sun, 1 Jul 2018 10:06:41 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJ+7v7c9tSpHQraDyQXLE12cLr2EOe9SGufv01c8bo+59EAni4uNgVBDBpCjgoMxpf1JBRP X-Received: by 2002:a63:bf08:: with SMTP id v8-v6mr18652968pgf.3.1530464801048; Sun, 01 Jul 2018 10:06:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530464801; cv=none; d=google.com; s=arc-20160816; b=LBOxPa+IWSfmoWPslJjhKTlxCzAy42glTPNffRKY+z4GPbyjRZ7NQzVPoqrNK+w9LO cpBYDNmM+bXojuSZLgkltcCQBMqwsCEkwR7kWUoXgOCntHEdrMP/GaURgQQaK88jXgpR u9yyu9KJYVW1gJVbsCltVPhbqj/EgAgvpR2Vv9zLPE4aNmY8TE6j7HZRbKXmXIONgClu HxnVdeW3eiZXN4H358bYbpxOuqavZAMWsIYuuhFhrxzrHOp2bydzBuh9k/RxJSWEjHnN hTSx0U5IQMIF9KITTwcconLr+P6HZcoJ4OXxB+l0OR4JIJiyv/16lVRxfJ5R8VoOYej8 tlig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=QicTbmwWtPNTt7Yi6pnnuCikkJ6H/AiHdoWGpUm5PV8=; b=0JzzEtStjoLhFbO5DowbWALc2tlaKlEI5FrpHcDAxOAlZEyFiaDH1A1lQ6mL4RQLrr uvB3Eyq0JVcOnjW5tH5mWYmhjHhhwLf2QmKXD9qZHnFcBYU1GixlpIoVz6zUn4EHossI 8vIExS5HAD6dqtJGbtUE5oEIH+Btph7s7TM6LPinC+fy/QiCykQcPf94eIpjkRCglqYh pUMAdLi2o/TU3SjRxRFOPCKWNaf/hTGwR8N3lWi2btJLDT0AvtjecybydxibhaRV4e6w Hxa7Bkq/81ggIZ1HlHsc1+dvjAEPU5lnR3pyhZIrz2WgcUFDbsgZH+3O7JdFKtCpEXnb YzIw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p18-v6si14139960pfe.150.2018.07.01.10.06.26; Sun, 01 Jul 2018 10:06:41 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1032205AbeGAQme (ORCPT + 99 others); Sun, 1 Jul 2018 12:42:34 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:37636 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1031805AbeGAQm3 (ORCPT ); Sun, 1 Jul 2018 12:42:29 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 570D0AA6; Sun, 1 Jul 2018 16:42:28 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alexandru Ardelean , Stable@vger.kernel.org, Jonathan Cameron Subject: [PATCH 4.17 129/220] iio: adc: ad7791: remove sample freq sysfs attributes Date: Sun, 1 Jul 2018 18:22:33 +0200 Message-Id: <20180701160913.720452388@linuxfoundation.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180701160908.272447118@linuxfoundation.org> References: <20180701160908.272447118@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.17-stable review patch. If anyone has any objections, please let me know. ------------------ From: Alexandru Ardelean commit 7eb6b35d93c356f1afebbfb808bc296d6351e708 upstream. In the current state, these attributes are broken, because they are registered already, and the kernel throws a warning. The first registration happens via the `IIO_CHAN_INFO_SAMP_FREQ` flag from the `ad_sigma_delta` driver. In this commit these attrs are removed, and in the following the IIO_CHAN_INFO_SAMP_FREQ behavior will be implemented, which replaces these hooks. This is done to make things a bit easier to review as there is a bit of overlap in the patch if it's done all at once. Fixes: a13e831fcaa7 ("staging: iio: ad7192: implement IIO_CHAN_INFO_SAMP_FREQ") Signed-off-by: Alexandru Ardelean Cc: Signed-off-by: Jonathan Cameron Signed-off-by: Greg Kroah-Hartman --- drivers/iio/adc/ad7791.c | 49 ----------------------------------------------- 1 file changed, 49 deletions(-) --- a/drivers/iio/adc/ad7791.c +++ b/drivers/iio/adc/ad7791.c @@ -244,58 +244,9 @@ static int ad7791_read_raw(struct iio_de return -EINVAL; } -static const char * const ad7791_sample_freq_avail[] = { - [AD7791_FILTER_RATE_120] = "120", - [AD7791_FILTER_RATE_100] = "100", - [AD7791_FILTER_RATE_33_3] = "33.3", - [AD7791_FILTER_RATE_20] = "20", - [AD7791_FILTER_RATE_16_6] = "16.6", - [AD7791_FILTER_RATE_16_7] = "16.7", - [AD7791_FILTER_RATE_13_3] = "13.3", - [AD7791_FILTER_RATE_9_5] = "9.5", -}; - -static ssize_t ad7791_read_frequency(struct device *dev, - struct device_attribute *attr, char *buf) -{ - struct iio_dev *indio_dev = dev_to_iio_dev(dev); - struct ad7791_state *st = iio_priv(indio_dev); - unsigned int rate = st->filter & AD7791_FILTER_RATE_MASK; - - return sprintf(buf, "%s\n", ad7791_sample_freq_avail[rate]); -} - -static ssize_t ad7791_write_frequency(struct device *dev, - struct device_attribute *attr, const char *buf, size_t len) -{ - struct iio_dev *indio_dev = dev_to_iio_dev(dev); - struct ad7791_state *st = iio_priv(indio_dev); - int i, ret; - - i = sysfs_match_string(ad7791_sample_freq_avail, buf); - if (i < 0) - return i; - - ret = iio_device_claim_direct_mode(indio_dev); - if (ret) - return ret; - st->filter &= ~AD7791_FILTER_RATE_MASK; - st->filter |= i; - ad_sd_write_reg(&st->sd, AD7791_REG_FILTER, sizeof(st->filter), - st->filter); - iio_device_release_direct_mode(indio_dev); - - return len; -} - -static IIO_DEV_ATTR_SAMP_FREQ(S_IWUSR | S_IRUGO, - ad7791_read_frequency, - ad7791_write_frequency); - static IIO_CONST_ATTR_SAMP_FREQ_AVAIL("120 100 33.3 20 16.7 16.6 13.3 9.5"); static struct attribute *ad7791_attributes[] = { - &iio_dev_attr_sampling_frequency.dev_attr.attr, &iio_const_attr_sampling_frequency_available.dev_attr.attr, NULL };