Received: by 2002:ac0:f2c4:0:0:0:0:0 with SMTP id f4csp2181541imp; Mon, 25 Jul 2022 08:11:49 -0700 (PDT) X-Google-Smtp-Source: AGRyM1s46R6ATSYsqXEWHkIVXtjdOYCWs2SanKP6rQ6UTzMT7Nybo8AVDj54cSvCzfXpcmJZLoV6 X-Received: by 2002:a63:2dc6:0:b0:419:f2d0:4777 with SMTP id t189-20020a632dc6000000b00419f2d04777mr11130878pgt.203.1658761909416; Mon, 25 Jul 2022 08:11:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658761909; cv=none; d=google.com; s=arc-20160816; b=yarg6l89yo1PD+3Uc6Mne0MgWvQDjBKWAo1tsjRUL8rumSnlRVETcymrcrJkF8PT1A /sRFDCF3BYu/SaM5h0fn2YNyvsRrUoqKJTppWNfD8lO8/bCX0mMfPPEhZqZmcq7hgZ8D 8rloqFxHaEIq7ibkDTXNI6wTJUP7f4p5gXPDWr5qRyNFNwnF3u4FcKpGfapLr2Q4IErf 8uBcmfs2JeAyng/eb17ZjlqI24hlpUJ2ehFA8l2SsWokCG/4xwhpLGtuJA4EG5f53qQ2 tdwjDHtY/1eV1rFIhO8/ubVhd61MzHlDIAAgdl43eWM8cD5MaCJvOE8P0yMuUws9PuMm /GbA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=7E43xJTOa/UwgKbf8wS2dK/BplFX0VKzt0c1x9A4UZY=; b=gp0M0+2gXgPMF7NijOm9Ijde8Ac449Zjs44OZYIsL6gBeU+om+TBZIDYRM7m4jL/7S XRhHXNg/ACXfbhyaKT4FjPogs88LLzIHoxJZHbm7phcNx25xLDuAV+wgUhGGDvPrst5i TAzRdNg0wH/zKNdVnQ4EHmsknUNNDuTCpBlG0r+QJzHn2b8CyUjAJ0yniJn+qStwvIB7 Lt3diZRozIbxAm/E/OUESZaD20AGESKxWKK9/zV8H8dniGbu8tVHULTPXqWlidVaQwLc 79bI6ew7wtz9i/spVMxEhifyOLngZn4KB/q/+U9TPNwApyGXIJIo1sdfupzWrAMcR2Ch nH9g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e23-20020a635457000000b00412a34ca92esi14700676pgm.153.2022.07.25.08.11.34; Mon, 25 Jul 2022 08:11:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234602AbiGYOwj (ORCPT + 99 others); Mon, 25 Jul 2022 10:52:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44404 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233521AbiGYOwi (ORCPT ); Mon, 25 Jul 2022 10:52:38 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 1E5301837D for ; Mon, 25 Jul 2022 07:52:34 -0700 (PDT) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 55C772B; Mon, 25 Jul 2022 07:52:34 -0700 (PDT) Received: from e121896.arm.com (unknown [10.57.41.239]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 794413F73D; Mon, 25 Jul 2022 07:52:32 -0700 (PDT) From: James Clark To: suzuki.poulose@arm.com, coresight@lists.linaro.org Cc: mathieu.poirier@linaro.org, mike.leach@linaro.org, leo.yan@linaro.org, linux-kernel@vger.kernel.org, James Clark Subject: [PATCH v1 0/4] coresight: Reduce duplicated sysfs accessors Date: Mon, 25 Jul 2022 15:52:17 +0100 Message-Id: <20220725145221.517776-1-james.clark@arm.com> X-Mailer: git-send-email 2.28.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The intent of this change is to reduce the large number identical of functions created by macros for sysfs accessors. It's possible to re-use the same function but pass in the register to access as an argument. This reduces the size of the coresight modules folder by 244KB. The first two patches are refactors to simplify and remove some dead code, and the second two are the changes to use a shared function. Testing ======= No changes in any of the outputs: cat /sys/bus/coresight/devices/*/mgmt/* > before.txt cat /sys/bus/coresight/devices/*/mgmt/* > after.txt diff before.txt after.txt With the following modules loaded: ls /sys/bus/coresight/devices/ etm0 etm2 funnel0 funnel2 replicator0 tmc_etf0 tmc_etf2 tpiu0 etm1 etm3 funnel1 funnel3 stm0 tmc_etf1 tmc_etr0 James Clark (4): coresight: Remove unused function parameter coresight: Simplify sysfs accessors by using csdev_access abstraction coresight: Re-use same function for similar sysfs register accessors coresight: cti-sysfs: Re-use same functions for similar sysfs register accessors drivers/hwtracing/coresight/coresight-catu.c | 27 +-- drivers/hwtracing/coresight/coresight-core.c | 14 ++ .../hwtracing/coresight/coresight-cti-sysfs.c | 213 +++++++----------- drivers/hwtracing/coresight/coresight-etb10.c | 28 +-- .../coresight/coresight-etm3x-sysfs.c | 34 +-- drivers/hwtracing/coresight/coresight-priv.h | 48 ++-- .../coresight/coresight-replicator.c | 10 +- drivers/hwtracing/coresight/coresight-stm.c | 40 +--- .../hwtracing/coresight/coresight-tmc-core.c | 48 ++-- include/linux/coresight.h | 18 ++ 10 files changed, 196 insertions(+), 284 deletions(-) -- 2.28.0