Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1935732imu; Tue, 6 Nov 2018 06:39:39 -0800 (PST) X-Google-Smtp-Source: AJdET5cjhgp5W7Q0VS+KnJAoFgOWVoZLHdm9Z4igeiSTRre75svZp6rYaCgVKcYpFvs5qTuWgDKr X-Received: by 2002:a63:6ac5:: with SMTP id f188mr24281662pgc.165.1541515179085; Tue, 06 Nov 2018 06:39:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541515179; cv=none; d=google.com; s=arc-20160816; b=QwRCgz5AvqI3jwYSBJhJZxzLVW7Sjjmkh34SW1QfJ+0P2CBWxXZTWxKhsqZnen6mNz Qr/UphbG/sUWKmGa2s26dsdbj3OLW9EfBWG+NIDWHfasH4eC8YoO2jMzZ+e7+3iLKlCa 9208cbpV8QmRB30xSDRLbVP1+d7e4NrnFUKdY1ILEpLhqp0h+GFT3TehVTA71esYBsXI /24rqSHo3Mm8a22qCPfDYZUzKRA+ONUCGfarN43XAq6/Mb+FM4jENyYcDufqT5kxnaaV zZt/Z9bES3Uz8u6jwrbbtXzKtAYfslFmZqCT7qwrZV0Zir3/aW859sXP80zvBxlJ6zxc Ja/Q== 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=uNGDvFPN4zXrSe9ynX/chysgNcrdJz+M6yhXOppEXqw=; b=GlkRI4GUtjnwqEQI+hbG3OgfA+sQhhofgaSB/gWIHFk4VSODTL9fxXlGxcDz5l3Hgv t0tLzPanMkmgvjFyAlaXXaZK/yXo8iNY4D3rCJBUV0Z2RKia+J/2lZf+KkMC88wpuCJO kfhILB+lEF5nberMMJuoVvGg4LFplAy/A7PMFRvvMsOZd5n/k76IxLlaYIThFQ1UAFEW XLQfwbjkdWVQdf8YZbgtc6zNUFfClMcEFFINlO22dO9Og4aftnD4USTy8dhKucFi+yVX fKRQbitXToLH3NeL61GNKWP6XLewuaIDKwPP+rlleXZiWu5wVHidiYsvmYfI1LgPPCqb +p+A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=IRuqjrLv; 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 l14si10181679pgi.147.2018.11.06.06.39.17; Tue, 06 Nov 2018 06:39:39 -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=IRuqjrLv; 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 S2388828AbeKGACK (ORCPT + 99 others); Tue, 6 Nov 2018 19:02:10 -0500 Received: from mail-pg1-f196.google.com ([209.85.215.196]:43373 "EHLO mail-pg1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388583AbeKGACK (ORCPT ); Tue, 6 Nov 2018 19:02:10 -0500 Received: by mail-pg1-f196.google.com with SMTP id n10-v6so5887289pgv.10 for ; Tue, 06 Nov 2018 06:36:40 -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=uNGDvFPN4zXrSe9ynX/chysgNcrdJz+M6yhXOppEXqw=; b=IRuqjrLvFtNyyzsM69h7vDIEacAd3HwDNczvFQ2ugGYRaUuv1nUW1bSytwEc8m6Zgw oa6QsmW9F2TIoIsHIYdZJGbkI7BSr/xgTb6o33FU1oLset9FvUzuJxGpHmgAHRkne4NY PdgCP9ZHVc7svhOca9Tp5gEptb1Oc9RGXjO/rsBjSFgtn6M0vJGwyY9HK+3lE279O3Zz +B1pZ6S7R0u5jADQ8P9MUPTMhHN+w2EX11JvjilJel79l/57+sGSdpQoWdUb4ofI3zf4 Y/vjz1sisXDXIJ57Nkshl3hAMILFKmnxypJgTtVqzetxVKsNn1TroOhSaXsimOThHkNx NyiQ== 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=uNGDvFPN4zXrSe9ynX/chysgNcrdJz+M6yhXOppEXqw=; b=O1zPhjIVjVG1Z/hPcRxLWJsCWQGLotyfOIWSKrt+cvD5ypQXh4MUVaMfnl08pGG6Js XaDOcFRwJqI6pXlLyQP9oJ+xIkcm6Wp7VqPL/Ev/nnxcfgpejETmFxQkUttbYJpea2vQ DMq8WYZgGxljLnZPl/IKmzKeTXsRp3XUewD9PWXMDE1j/EHtG8gTSSV/dT/rSNUW6W1V HMFlCCUE3/SfkrWyztAZi8w+0N7jIezHGj7x110wfs9UP4S8Y0YaSvGjskW5JjSjO9k2 7EtfG5GnXgTXNsbPftqXNgymve3wFlsiBNEzmTm1FtkAOwmuDNKG21FYJ3uEFqMjw5Yl vHyA== X-Gm-Message-State: AGRZ1gJ6yxA3GweJ8WumcRJo1gbdqch4jhgz725kZ8LofI3fmGkQRMfM gVLJoCnsznSrnp1NqxUiJEo= X-Received: by 2002:a62:5615:: with SMTP id k21-v6mr19013773pfb.190.1541514999723; Tue, 06 Nov 2018 06:36:39 -0800 (PST) Received: from localhost (68.168.130.77.16clouds.com. [68.168.130.77]) by smtp.gmail.com with ESMTPSA id b75-v6sm55255142pfe.148.2018.11.06.06.36.38 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 06 Nov 2018 06:36:39 -0800 (PST) From: Yangtao Li To: ralf@linux-mips.org, paul.burton@mips.com, jhogan@kernel.org Cc: linux-mips@linux-mips.org, linux-kernel@vger.kernel.org, Yangtao Li Subject: [PATCH] MIPS: r2-on-r6-emu: Change to use DEFINE_SHOW_ATTRIBUTE macro Date: Tue, 6 Nov 2018 09:36:36 -0500 Message-Id: <20181106143636.8450-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 --- arch/mips/kernel/mips-r2-to-r6-emul.c | 32 +++++---------------------- 1 file changed, 5 insertions(+), 27 deletions(-) diff --git a/arch/mips/kernel/mips-r2-to-r6-emul.c b/arch/mips/kernel/mips-r2-to-r6-emul.c index eb18b186e858..28cb88daa3ef 100644 --- a/arch/mips/kernel/mips-r2-to-r6-emul.c +++ b/arch/mips/kernel/mips-r2-to-r6-emul.c @@ -2242,7 +2242,7 @@ int mipsr2_decoder(struct pt_regs *regs, u32 inst, unsigned long *fcr31) #ifdef CONFIG_DEBUG_FS -static int mipsr2_stats_show(struct seq_file *s, void *unused) +static int mipsr2_emul_show(struct seq_file *s, void *unused) { seq_printf(s, "Instruction\tTotal\tBDslot\n------------------------------\n"); @@ -2308,9 +2308,9 @@ static int mipsr2_stats_show(struct seq_file *s, void *unused) return 0; } -static int mipsr2_stats_clear_show(struct seq_file *s, void *unused) +static int mipsr2_clear_show(struct seq_file *s, void *unused) { - mipsr2_stats_show(s, unused); + mipsr2_emul_show(s, unused); __this_cpu_write((mipsr2emustats).movs, 0); __this_cpu_write((mipsr2bdemustats).movs, 0); @@ -2353,30 +2353,8 @@ static int mipsr2_stats_clear_show(struct seq_file *s, void *unused) return 0; } -static int mipsr2_stats_open(struct inode *inode, struct file *file) -{ - return single_open(file, mipsr2_stats_show, inode->i_private); -} - -static int mipsr2_stats_clear_open(struct inode *inode, struct file *file) -{ - return single_open(file, mipsr2_stats_clear_show, inode->i_private); -} - -static const struct file_operations mipsr2_emul_fops = { - .open = mipsr2_stats_open, - .read = seq_read, - .llseek = seq_lseek, - .release = single_release, -}; - -static const struct file_operations mipsr2_clear_fops = { - .open = mipsr2_stats_clear_open, - .read = seq_read, - .llseek = seq_lseek, - .release = single_release, -}; - +DEFINE_SHOW_ATTRIBUTE(mipsr2_emul); +DEFINE_SHOW_ATTRIBUTE(mipsr2_clear); static int __init mipsr2_init_debugfs(void) { -- 2.17.0