From patchwork Mon Mar 12 12:06:53 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandru Ardelean X-Patchwork-Id: 10276083 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 201D3602BD for ; Mon, 12 Mar 2018 12:07:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 130D528C00 for ; Mon, 12 Mar 2018 12:07:11 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0753428D16; Mon, 12 Mar 2018 12:07:11 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D341928D77 for ; Mon, 12 Mar 2018 12:07:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751104AbeCLMHI (ORCPT ); Mon, 12 Mar 2018 08:07:08 -0400 Received: from mail-by2nam03on0075.outbound.protection.outlook.com ([104.47.42.75]:30400 "EHLO NAM03-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751229AbeCLMHH (ORCPT ); Mon, 12 Mar 2018 08:07:07 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=analog.onmicrosoft.com; s=selector1-analog-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=3yC/QkGvd9pdndzXtIoqMODexrsqzCE5BRp7NyifWVU=; b=s4oOefqfu5uGtWXHBFtjQmFdTAEX8C5EzmNp3R/aS8SgqgZhEwcDMoAgPSr28biMH/gSvAAKzdMvBV6hObYL88tmKVRoK737JszNmyG0ZcFdYgGEfgxbGvEwRcspHCYlQS0QQ2D5ad6RoN9c/38y+gggKXwinWcnPC8R1k2grmc= Received: from CY4PR03CA0005.namprd03.prod.outlook.com (10.168.162.15) by BN6PR03MB2609.namprd03.prod.outlook.com (10.173.143.20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.567.12; Mon, 12 Mar 2018 12:07:05 +0000 Received: from BY2FFO11OLC015.protection.gbl (2a01:111:f400:7c0c::116) by CY4PR03CA0005.outlook.office365.com (2603:10b6:903:33::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.567.14 via Frontend Transport; Mon, 12 Mar 2018 12:07:05 +0000 Authentication-Results: spf=pass (sender IP is 137.71.25.55) smtp.mailfrom=analog.com; kernel.org; dkim=none (message not signed) header.d=none;kernel.org; dmarc=bestguesspass action=none header.from=analog.com; Received-SPF: Pass (protection.outlook.com: domain of analog.com designates 137.71.25.55 as permitted sender) receiver=protection.outlook.com; client-ip=137.71.25.55; helo=nwd2mta1.analog.com; Received: from nwd2mta1.analog.com (137.71.25.55) by BY2FFO11OLC015.mail.protection.outlook.com (10.1.15.59) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.20.527.18 via Frontend Transport; Mon, 12 Mar 2018 12:07:04 +0000 Received: from NWD2HUBCAS8.ad.analog.com (nwd2hubcas8.ad.analog.com [10.64.69.108]) by nwd2mta1.analog.com (8.13.8/8.13.8) with ESMTP id w2CC74cU007399 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=FAIL); Mon, 12 Mar 2018 05:07:04 -0700 Received: from zeus.spd.analog.com (10.64.82.11) by NWD2HUBCAS8.ad.analog.com (10.64.69.108) with Microsoft SMTP Server id 14.3.301.0; Mon, 12 Mar 2018 08:07:03 -0400 Received: from saturn.analog.com ([10.50.1.244]) by zeus.spd.analog.com (8.15.1/8.15.1) with ESMTP id w2CC71YC026433; Mon, 12 Mar 2018 08:07:02 -0400 From: Alexandru Ardelean To: CC: , , , Alexandru Ardelean Subject: [PATCH 1/2] iio: adc: ad7791: remove sample freq sysfs attributes Date: Mon, 12 Mar 2018 14:06:53 +0200 Message-ID: <20180312120654.1806-1-alexandru.ardelean@analog.com> X-Mailer: git-send-email 2.14.1 MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:137.71.25.55; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(346002)(376002)(396003)(39860400002)(39380400002)(2980300002)(438002)(199004)(189003)(50466002)(6916009)(53416004)(106466001)(4326008)(50226002)(47776003)(336012)(107886003)(51416003)(7696005)(2906002)(48376002)(1076002)(2351001)(6666003)(16586007)(356003)(246002)(305945005)(7636002)(8936002)(5660300001)(54906003)(106002)(186003)(316002)(478600001)(36756003)(59450400001)(26005)(77096007)(8676002)(575784001)(86362001); DIR:OUT; SFP:1101; SCL:1; SRVR:BN6PR03MB2609; H:nwd2mta1.analog.com; FPR:; SPF:Pass; PTR:nwd2mail10.analog.com; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BY2FFO11OLC015; 1:QLF2HeECyA8rWDQke/409S5Fmi0Pjs6PBPfXLvsAMrJSVcz1viFDssv8wTf4wv/NjIQ+oKSbTDj+ksCw8j7gu3D1z/qzrI39gVy8rSUNxsowc7Ysbidy7th94AoRnelv X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 0c86d41d-fd80-46fd-7750-08d58811c57e X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(5600026)(4604075)(4608076)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060); SRVR:BN6PR03MB2609; X-Microsoft-Exchange-Diagnostics: 1; BN6PR03MB2609; 3:QdRwuMxS6b2/7JrSKqRiqPXXiZBPLpxvUxPTx3RyYKb8mMMSvu6+jfdHc9F9fhOfka0KnT/WJ5hmRsj1+W0CJQRkSaPImq+PvbKAfsEWZYHK40zCoS1xdOff0O6J2hpE6+XbM0hAQi47NsFc0E1CI7sJdXEsNLbjst9mAMMVXpJ7yC+nadwaKHRD6Zp1f0FxlHYEJrnlYIDuDHXBRmn71htS74TS/FeLwFnnWvOpmD4xKk1MXWTptuYFf1R8LuqTvYM1whyWwGCdg6FPpMOg2zSTeG805Gh8Z1MWN7NzvRg8GiKVO4gQ0PdvrpdLwqd2kkHo8KSM8xjIGBW00ik6WfRCqHLvP+UqhqEXOqISPtE=; 25:TKMDx8kdEeQHSfwZm3GT14NJi4H3pVRU9Vc0xZRHtP9cVoMxj0w/LGq7M6GsaP+d0MQF4uLTeE9vHwkMr8sy0Mt8opU0gYIyWcxK9FU8GWwFA9J2DJyPsjp/thDwYD3/rJ1y3kGHHRBpY3KxOnbDcHK+qjH7nxc2HqzqwIMqlyXqZgnceIZVTgyqLOJbPmEEdcvX/cNMACTatK0M1SK8H9apB6Xi9bF3Wow5pd4OPw77qRRX5L6e+yJjxY/hALtZ1SHfw8zPtiMjNukQaCaWtkx/hENGirthr0KY4XGyy67n5uu31SKI6FIQzYggSzjfsePDgPElVNqVomo5HlvhnA== X-MS-TrafficTypeDiagnostic: BN6PR03MB2609: X-Microsoft-Exchange-Diagnostics: 1; BN6PR03MB2609; 31:jXZLE6OVyJZrSLrOWRWJ1UPoUlisu7JnVXty2ykDuj0RXyXcNc+zzNWugaWmbGpzlsWBzABNI8TemknyD59KM7WWDh/pLrTzqskAb5yEqHYqsBgXWhP34rDKVkCXTP/rXGkp3ndB1pHNcna1VYR8oA8XsKKE/Dnyi0BzS0tFdFKGsPfs7c5IiQLwKqDmmRe9SykFYSs10B8k66+lOGuiJXLwwpQEyr4THISu6MKAqgM=; 20:OymcLHRBbajCMOOoAIzd1JbPynL417ezW50Cz+MLgCoWhS8naQw/kjMIb0BAIb8rlCW9yVvvOwTmnShkRURTwHyJlPQoHqdxu4OwI3b1o3KNJdDcumxh/uwE2WFlkgXv3Puze257Sn+Z7XY+QoBn3uRjF3mQNcNwgVZSzhJjZ2ySvGThZmT+3GdZB45mRy5GI0qtDXnAUU6Al0efZOmz5sjtFmpVwB4jxoqdd148yUf7C7rcBTDjvgHX70QqP+VBhMrwJkbRDmcj/S12Fi04qmiiccc528M98D8YrwkR0pdqNTTHHUufljZuIz42u9DUom7adhuLhaxobq15FoMB+HGq86TKp8Aq9fE+2taIhOVlXfqLwe6s0u10vlac0IhRhyObtN+XBCqkfkcDzSeGOHibKwGEDvIoPBsSs6kM2uPKQwrbpoLHnb4U840CHo7s6K12Jr0EklPcm5tQ7yYzskeT+BcUOqaQrD0Rq+NlhpSplFmaeN0SUhJfxEnFFo7f X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(232431446821674); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040522)(2401047)(8121501046)(5005006)(3002001)(93006095)(93004095)(10201501046)(3231220)(944501244)(52105095)(6055026)(6041310)(20161123562045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(20161123558120)(6072148)(201708071742011); SRVR:BN6PR03MB2609; BCL:0; PCL:0; RULEID:; SRVR:BN6PR03MB2609; X-Microsoft-Exchange-Diagnostics: 1; BN6PR03MB2609; 4:cBCq7SpXH5cmfJAgyD/QF/G8YePtedps2rsTXxdCJIBxVyLDS0iA/7DQsQqPg9wQ9RTs2Q7XivnCkW6/atmoArobe/9Q3/0Tdr9s4v7XaS4RfI+QmmdJkPBbOxBPAbgLZUJzjm9MxYEbvnhTqW5BXKBX/eqnfrXq+lLyq0P3iTCFzWF9RGbwCg1ksk3IcULUHcf/+/yQNjfRqGATO8U72OL4/HBd9DzutdIMDM9equ5siOOnYOTX4vKgfE52gyP8QLcWKWQb8aR2XNxA+KMFsu+SG95tFZL/3GT8Rq2Xgl+oznuMGxxacqr0OUOLWDqa X-Forefront-PRVS: 06098A2863 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BN6PR03MB2609; 23:1S5//3KgFHvLUfRGD0woe8kKmKjLOpmZ6dCQPHrXm?= =?us-ascii?Q?hgnxINMm+ozllJMnaSr8QNmkUPEXQZxrInoyeujqVfR57AGqUfEyGc96KxNP?= =?us-ascii?Q?wng+VEpLgMdpeKq9ZPf9rPOWKL4f2NhS06zayPpUGU1lAePoDelXU+2voZgZ?= =?us-ascii?Q?IAjum18LBMESmv+kat4ikYeIg4iMsK8NYvbn4Zu/SASwnKlv5BCPemk1h6SL?= =?us-ascii?Q?8+ZYjReao/NjRYU2Ii7Dz3EaUJQIpz8R0HC609tHoboAOQC97Fb6TS4sYD7/?= =?us-ascii?Q?nrGqI48a4u06Mi2edty+JDrRgACXMFNcOjk8fh6KFKTr6GcH695s23rO9Pkr?= =?us-ascii?Q?qQwNaJ2W4NW2DGz7teFZkmhE6rlDEH29JEiRuRrVsIAwah7k1b+v1D7rf535?= =?us-ascii?Q?yP/3GDx4tQyGDSJoyiIMqn1UQtnHExKjaVzKUYIQgFZZSrdz0Sagmb4UvS5T?= =?us-ascii?Q?NYhysXqKjQFSopdMiap+nraLekkeOXFwwnxHQ0NAifo0Fz0r2Svvtk6wNops?= =?us-ascii?Q?CNqbRC6YYpplZW/PoFtpPeG3xwBWC9JAbMHgL0A1TR+6/NC4iJ5qqyPNIvRF?= =?us-ascii?Q?2r7hFiQGk5THvrRcWy/p64n+FeYMDggbeI2CBR1L4SXoqkDqWWCVm/n2EP+i?= =?us-ascii?Q?m/no6JoiNzalx6V3vNoZ4HD7DhkXm6urSPp2pAPZhTpqz9U579kSDUUsO4OW?= =?us-ascii?Q?2yVPclapHbIk7zxMqxwUSIdJ1M3nVNlERdA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Tzu1OyxKS4ltXmprRtYhATq9KE5OKnHtNC5bvVmRTqViNIsP5GNpwGsVpvrq7TaI7ltvnYrH7X8=; 24:wrprlhlyUJshI1IAY/gBqyW3wm7KZ3obEtnNQEvTc/4ao3ZqHRcDabVBkJV8SofH6NUwMGkFYimbPRrASMJ4gSBiwOry8Cq6J9yEuA5P9GU=; 7:di32APN1MJmjzHJ12DjullEHKKOxYQnQ2TdCIHmfbGH/Z0zMy3s7s/Q0x8ESWfyAnnADOeqnwgdJSwiyCVq+OOQiR+gIzsOens8hKYU6IfghBPA4+//c+x00MqciD4Nuly3qBU+W/41nXmutEOJwKoT6ZfaFcOXDpXK7fBIp+fiXZfttcAOsp+5AaY0W68tP1rDYtyLJ+tpV8fjBmHLZBfAVRIyIpdC3HEltaQFvkr/hcxjFZ57ITLIUG1gCgyV/ SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: analog.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Mar 2018 12:07:04.9050 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 0c86d41d-fd80-46fd-7750-08d58811c57e X-MS-Exchange-CrossTenant-Id: eaa689b4-8f87-40e0-9c6f-7228de4d754a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=eaa689b4-8f87-40e0-9c6f-7228de4d754a; Ip=[137.71.25.55]; Helo=[nwd2mta1.analog.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR03MB2609 Sender: linux-iio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- drivers/iio/adc/ad7791.c | 49 ------------------------------------------------ 1 file changed, 49 deletions(-) diff --git a/drivers/iio/adc/ad7791.c b/drivers/iio/adc/ad7791.c index 70fbf92f9827..03a5f7d6cb0c 100644 --- a/drivers/iio/adc/ad7791.c +++ b/drivers/iio/adc/ad7791.c @@ -244,58 +244,9 @@ static int ad7791_read_raw(struct iio_dev *indio_dev, 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 };