Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2440493pxj; Sun, 23 May 2021 00:00:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwdjgzm/CAHyRvDb4b9p7Kd7JzMguhCU5nPfgkkZD1ZQO1wrxWUOo4PtRk8SGp9USLgqTph X-Received: by 2002:a17:906:7e51:: with SMTP id z17mr17581390ejr.2.1621753223834; Sun, 23 May 2021 00:00:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621753223; cv=none; d=google.com; s=arc-20160816; b=JN348LfGbR5j/lpdgDKT8v/5B01qpO895j701hxgXLZLAe1oiIu+V/ob6nFKHnDXgA 8zZmSJjkNAyW4fGncNOGNzaEa3tvnuHj+zunOHk4wgF2sldxYBEjPkGlDWs/gSV92FDA 2CfNyzJUcgsTbkm9NhqXXcDpMMhxtLGUnK7691O7XCupATq2P/3abdwfgRm4Q3ZCgizq c6b6eCCR3+xpvpPhjqIC67kX73buJm+m9QpuNlxjuh/4Kyx8v+wz1lPC84cpD1+YCbIG BJIrJeHe/GlfTc0LF24CWk6UiXTAKJY/7EKbxXx0xtOIBofaRpfU+/VdbAsIWPKhmI7s y8KQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:subject:cc:to:from; bh=3ksmRHed5eZ6GxWeJLzeeWG/CnEOIBCswMIjsxtLIcE=; b=dSDkV+8vPg2YiqzYZ/YaLNPkWJLtB2bkD5vueKgEJmpgjQ+pRSLfjH535qACo29o64 qosYEHWVq4RW2aDOWdw8HHuEKbe4HxeGH93duLMurzib7TxFWe/1N+ILcmy/D60f2FR3 hTgF91lJWquOJtdN40ILkLQE6PFs5DaSobAoVgZfXKu6NXarjCvEewLqF1LPFHQTNpzG Az6XLvylquw71Gtw5CYqR4q+v7Xy2bPLULBgRKHbBdpjYUf97JIRndHxErMMs0+FJ0w4 yCtpI8bW5TJp3r1Co/IxKLhxk06RAZMw1frLdeaDNt5aDL4zcyIIp/FxbZ4I0Z1T4KTA QWhg== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c95si11236032edf.464.2021.05.23.00.00.00; Sun, 23 May 2021 00:00:23 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231667AbhEWGxd (ORCPT + 99 others); Sun, 23 May 2021 02:53:33 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:5520 "EHLO szxga05-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231644AbhEWGxd (ORCPT ); Sun, 23 May 2021 02:53:33 -0400 Received: from dggems702-chm.china.huawei.com (unknown [172.30.72.60]) by szxga05-in.huawei.com (SkyGuard) with ESMTP id 4FnrY41PqDzkY2V; Sun, 23 May 2021 14:49:12 +0800 (CST) Received: from dggema769-chm.china.huawei.com (10.1.198.211) by dggems702-chm.china.huawei.com (10.3.19.179) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.1.2176.2; Sun, 23 May 2021 14:52:01 +0800 Received: from localhost (10.174.179.215) by dggema769-chm.china.huawei.com (10.1.198.211) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2176.2; Sun, 23 May 2021 14:52:00 +0800 From: YueHaibing To: CC: , , YueHaibing Subject: [PATCH -next] cuse: use DEVICE_ATTR_*() macros Date: Sun, 23 May 2021 14:51:52 +0800 Message-ID: <20210523065152.29632-1-yuehaibing@huawei.com> X-Mailer: git-send-email 2.10.2.windows.1 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.174.179.215] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To dggema769-chm.china.huawei.com (10.1.198.211) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Use DEVICE_ATTR_*() helper instead of plain DEVICE_ATTR, which makes the code a bit shorter and easier to read. Signed-off-by: YueHaibing --- fs/fuse/cuse.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/fs/fuse/cuse.c b/fs/fuse/cuse.c index c7d882a9fe33..0df886224afe 100644 --- a/fs/fuse/cuse.c +++ b/fs/fuse/cuse.c @@ -574,25 +574,25 @@ static struct file_operations cuse_channel_fops; /* initialized during init */ * CUSE exports the same set of attributes to sysfs as fusectl. */ -static ssize_t cuse_class_waiting_show(struct device *dev, - struct device_attribute *attr, char *buf) +static ssize_t waiting_show(struct device *dev, + struct device_attribute *attr, char *buf) { struct cuse_conn *cc = dev_get_drvdata(dev); return sprintf(buf, "%d\n", atomic_read(&cc->fc.num_waiting)); } -static DEVICE_ATTR(waiting, 0400, cuse_class_waiting_show, NULL); +static DEVICE_ATTR_ADMIN_RO(waiting); -static ssize_t cuse_class_abort_store(struct device *dev, - struct device_attribute *attr, - const char *buf, size_t count) +static ssize_t abort_store(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t count) { struct cuse_conn *cc = dev_get_drvdata(dev); fuse_abort_conn(&cc->fc); return count; } -static DEVICE_ATTR(abort, 0200, NULL, cuse_class_abort_store); +static DEVICE_ATTR_WO(abort); static struct attribute *cuse_class_dev_attrs[] = { &dev_attr_waiting.attr, -- 2.17.1