Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3880647imu; Mon, 10 Dec 2018 09:15:10 -0800 (PST) X-Google-Smtp-Source: AFSGD/VxfKUwptbHocK4roDt0tppUizpmWJOEmz9RJFZb240a65C5DRrEPwoULz2pL9LVsxKRaMx X-Received: by 2002:a17:902:e012:: with SMTP id ca18mr12838687plb.218.1544462110262; Mon, 10 Dec 2018 09:15:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544462110; cv=none; d=google.com; s=arc-20160816; b=Eeze/2eGuGc0jgvdlihxl9SCtT4bEk0pwV6+RLp2oFVUuOG7qjIucxi0GEvnL5teht qaqANl/OCHFejt+awRQO9eFu575+Aj3wgdFDHdhJwwLw3c0M2X05KvjKO+v3DQAZ37sZ 9hCxa1aexNxLAhz36U2EEmUQKnK3IdMP9CClhGwg0jM2OkDgv0VP/F8uJKoTKRFbSxFZ roBuuTe4kK5Az1obqybc12QOHkqbpou/TeN9JScJan0/zXi0a7I0nnaIUVFtQC2kb/7+ yrEp2IhII+UlbXo921OMvVGkO2mk2HTNW8FKx/053x2lMh1FQP/yv4Gj8RFCn5/S2Gvj sZ0Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature; bh=fGIARFtgCjNaTeWMW52dUjZPMdUwiznQnVtKUxB4PtA=; b=k3aZeSXPMNlH507pQ26lMgrY7vCcApg0u18M7/H0WfTqx1VmxiVAGBPfXyChlZ5/Gs IjLeQWp0gyrazi+0jRltXsM0hoV5vwqwDqdnwTz7e54Tm/pctOe3Y1+9+0EdYYQmfncS rMc/1P/AcszxBV3BFtlGUPkBnxozPWMkKi+uCpKqqHa0lkD94wAW6h/+Cnps+F54xmRi SrSBxExDW/hMwqploeRqle677iDEpLcXGJ7UuMvzYA/c0yvbFWV4QCeT3fo2dJ40B3n1 3d6ZtCMpwxwIOFY6hp0AFcqdHiPX8LIA9U91ww3bwZyIWMyd0/CkR8uKTBTaH5hbMmyU eG5Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=gc394AWx; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 31si10811559plz.263.2018.12.10.09.14.19; Mon, 10 Dec 2018 09:15:10 -0800 (PST) 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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=gc394AWx; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728302AbeLJQDb (ORCPT + 99 others); Mon, 10 Dec 2018 11:03:31 -0500 Received: from mail-pl1-f196.google.com ([209.85.214.196]:45110 "EHLO mail-pl1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726585AbeLJQDa (ORCPT ); Mon, 10 Dec 2018 11:03:30 -0500 Received: by mail-pl1-f196.google.com with SMTP id a14so5438581plm.12 for ; Mon, 10 Dec 2018 08:03:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=fGIARFtgCjNaTeWMW52dUjZPMdUwiznQnVtKUxB4PtA=; b=gc394AWx7F09NXioH7PBgXrqkEArK84xUOSPCjsORTVZZRemod0D0kiA8aAvIibOfA IQy8hPrYfT5vveQDaghzKpicTpdii05YtbOucM05eL8oi4FNVbXkp/w767SGLTrf/xoz wCxIRkNipz3g/4YZMKjGVNqBkJSK8v3fcIECs0kwH56CDJfSNhge+VqQdwKSidMju8Ke Vc4172Hmn+MIOeHWzWTTz4uyXImlkfCSDxWPy+09oi3TwHOqQa3SS2h171aJLMguVn8s GtZTvnSZN3eLt+TONU+zqDFrtX6JSxPLtHnQRWRJPEVxUpVdssIxyv4WVKODP76z4VMw +fUA== 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; bh=fGIARFtgCjNaTeWMW52dUjZPMdUwiznQnVtKUxB4PtA=; b=c0cERlK6b/BMABvr80jniKKTQ8g54dxo+ks6ud6TW+tXqyczqWK9Or5ufMWhsic9Nd 2rd0CObFSy3WDQnfcbGJUUXpsO0A6Fwenpp6s7NHOPtzRlCueOuBkQJ08C9zN1JKQk47 1It3knm2ZqF9A3yjDhw9wMS1IveYPRHzrGmorwl5Qo0aLmph/nUplJlsqOMAvGrjM0yN jn8+n33byfwrpg/MiQYX44D2DhZ8YsJpXsVLw9yQG5CluSoNwMKwqSuQzSOUHa0U04au w5EAvgMYW+8X/NRyw/EaiJmHr43dEJLsNbQY6CmmA5o0otdLdWEXKQH0oPSsEIKZcoAG IYGA== X-Gm-Message-State: AA+aEWadCbgtrX2YDJH4918AsdGmBFfM5KvqKg+IqUARFaK4d7Ue1lGo DasA/WYPJXbOqbpryoLUYDg= X-Received: by 2002:a17:902:6b84:: with SMTP id p4mr12846814plk.282.1544457809380; Mon, 10 Dec 2018 08:03:29 -0800 (PST) Received: from localhost (68.168.130.77.16clouds.com. [68.168.130.77]) by smtp.gmail.com with ESMTPSA id o13sm14618751pfk.57.2018.12.10.08.03.28 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 10 Dec 2018 08:03:28 -0800 (PST) From: Yangtao Li To: jakub.kicinski@netronome.com, davem@davemloft.net Cc: linux-kernel@vger.kernel.org, Yangtao Li Subject: [PATCH] bpf: convert to DEFINE_SHOW_ATTRIBUTE Date: Mon, 10 Dec 2018 11:03:27 -0500 Message-Id: <20181210160327.20811-1-tiny.windzz@gmail.com> X-Mailer: git-send-email 2.17.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Use DEFINE_SHOW_ATTRIBUTE macro to simplify the code. Signed-off-by: Yangtao Li --- drivers/net/netdevsim/bpf.c | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/drivers/net/netdevsim/bpf.c b/drivers/net/netdevsim/bpf.c index cb3518474f0e..14b4d9774708 100644 --- a/drivers/net/netdevsim/bpf.c +++ b/drivers/net/netdevsim/bpf.c @@ -48,7 +48,7 @@ struct nsim_bpf_bound_map { struct list_head l; }; -static int nsim_debugfs_bpf_string_read(struct seq_file *file, void *data) +static int nsim_bpf_string_show(struct seq_file *file, void *data) { const char **str = file->private; @@ -57,19 +57,7 @@ static int nsim_debugfs_bpf_string_read(struct seq_file *file, void *data) return 0; } - -static int nsim_debugfs_bpf_string_open(struct inode *inode, struct file *f) -{ - return single_open(f, nsim_debugfs_bpf_string_read, inode->i_private); -} - -static const struct file_operations nsim_bpf_string_fops = { - .owner = THIS_MODULE, - .open = nsim_debugfs_bpf_string_open, - .release = single_release, - .read = seq_read, - .llseek = seq_lseek -}; +DEFINE_SHOW_ATTRIBUTE(nsim_bpf_string); static int nsim_bpf_verify_insn(struct bpf_verifier_env *env, int insn_idx, int prev_insn) -- 2.17.0