From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A35E4C2D0EB for ; Sat, 28 Mar 2020 06:35:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 7A4D220714 for ; Sat, 28 Mar 2020 06:35:36 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="pJJ34XBL" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726268AbgC1Gff (ORCPT ); Sat, 28 Mar 2020 02:35:35 -0400 Received: from mail-pj1-f68.google.com ([209.85.216.68]:52739 "EHLO mail-pj1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725800AbgC1Gff (ORCPT ); Sat, 28 Mar 2020 02:35:35 -0400 Received: by mail-pj1-f68.google.com with SMTP id ng8so4866104pjb.2; Fri, 27 Mar 2020 23:35:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=y5jRiliTP1odCqMCzp/TxFT4UkMSNXFuQPuyIcWrqbQ=; b=pJJ34XBLUMRlelBTpFs5uzHyTLfRbPZ1roamcPfvs9Q79ItrkB5tzhTTzQsapvPvu4 eitHRogB/SfPP1UQdZspe3ZoKQGeofEo0uUVcao/Taqh8O0W7QIwGCk2SEBomgRW4sw1 bdrj9pfcLelC92VCRnGtWA5QeR4r467VjV67LpKqiB+fa0MJ4p2APmM5CwKslmFPGkPQ /WM3Pmy8bTANhtHBDDwEg0j+2eccK95cRqmuht/c9u7Rr26c1KLeHUb8QxlsxTrJtYda eZ0bPgFYXfN/YWPl7qvWB6rtEKrN+3phqIZn+ROu1oUpwi8gckBMjdbiquNIInatOxrA zehQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=y5jRiliTP1odCqMCzp/TxFT4UkMSNXFuQPuyIcWrqbQ=; b=CzVhxn8NhvK00SULKGJz5WuXMOjhztzYqHU7YaYRfrSEgDVbMovBxyum2EO1iS1+jj 9Cax6bR65iVkrEVXl2VpmtQPV1/1H75ZfEyllNwqrFHS5WHPVoP4N3QOF+SE40FaI3KA eTx21/EORSs1ltD3CiwH69AWKroEN7q7ZGzKn6rJ7XVVCroWsfjravGRwNzdMrGYdKZE 2+wRO3KMjEXCtdiYOcdam9RV5CDnUJO8rUCKGKzIZjCeWL5eiJiaTIptAmSI9yl8CZci 8UZsCZRjgr9Wp1+7F3LcLZ87RQ3SWuZj9kvJ3JZSBVafIhQtDx91nx88x5EbL9qdS2xe kLEw== X-Gm-Message-State: ANhLgQ2pXKIciZnGh5E6NPQYcgAZ2L9Ep1SHFW9Ajh8wgJMLn/3xljro 4B3p+ZKUN5U383DMhhpHQV5+98ilGuo= X-Google-Smtp-Source: ADFU+vtCckRcXihAbhwWPbL08Pub0omo2SoFC4vIMhHB3gP9bFWcdZD3FPEWV0nvvvBCk1ilfPqzOg== X-Received: by 2002:a17:90a:3606:: with SMTP id s6mr3447319pjb.195.1585377333561; Fri, 27 Mar 2020 23:35:33 -0700 (PDT) Received: from localhost.localdomain ([106.51.108.92]) by smtp.gmail.com with ESMTPSA id l13sm4989976pjq.42.2020.03.27.23.35.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 27 Mar 2020 23:35:33 -0700 (PDT) From: Rohit Sarkar To: linux-iio@vger.kernel.org Cc: dragos.bogdan@analog.com, Rohit Sarkar , Lars-Peter Clausen , Michael Hennerich , Stefan Popa , Jonathan Cameron , Hartmut Knaack , Peter Meerwald-Stadler , linux-kernel@vger.kernel.org Subject: [PATCH 1/2] iio: imu: adis16400: use DEFINE_DEBUGFS_ATTRIBUTE instead of DEFINE_SIMPLE_ATTRIBUTE Date: Sat, 28 Mar 2020 12:04:54 +0530 Message-Id: <20200328063456.24012-2-rohitsarkar5398@gmail.com> X-Mailer: git-send-email 2.23.0.385.gbc12974a89 In-Reply-To: <20200328063456.24012-1-rohitsarkar5398@gmail.com> References: <20200328063456.24012-1-rohitsarkar5398@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org debugfs_create_file_unsafe does not protect the fops handed to it against file removal. DEFINE_DEBUGFS_ATTRIBUTE makes the fops aware of the file lifetime and thus protects it against removal. Signed-off-by: Rohit Sarkar --- drivers/iio/imu/adis16400.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/iio/imu/adis16400.c b/drivers/iio/imu/adis16400.c index cfb1c19eb930..19a35967f385 100644 --- a/drivers/iio/imu/adis16400.c +++ b/drivers/iio/imu/adis16400.c @@ -258,7 +258,7 @@ static int adis16400_show_product_id(void *arg, u64 *val) return 0; } -DEFINE_SIMPLE_ATTRIBUTE(adis16400_product_id_fops, +DEFINE_DEBUGFS_ATTRIBUTE(adis16400_product_id_fops, adis16400_show_product_id, NULL, "%lld\n"); static int adis16400_show_flash_count(void *arg, u64 *val) @@ -275,7 +275,7 @@ static int adis16400_show_flash_count(void *arg, u64 *val) return 0; } -DEFINE_SIMPLE_ATTRIBUTE(adis16400_flash_count_fops, +DEFINE_DEBUGFS_ATTRIBUTE(adis16400_flash_count_fops, adis16400_show_flash_count, NULL, "%lld\n"); static int adis16400_debugfs_init(struct iio_dev *indio_dev) -- 2.23.0.385.gbc12974a89