Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp1670454ybk; Thu, 21 May 2020 12:19:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy8DDMmoVgOWJYSzBmbdqoelOaZI6l3S2taqTIjzwcLfA14QTNO0gg+8/AuPsm3YGvbNpYc X-Received: by 2002:a50:ee8e:: with SMTP id f14mr181604edr.115.1590088796820; Thu, 21 May 2020 12:19:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590088796; cv=none; d=google.com; s=arc-20160816; b=X73NAvXc/p0p/JprubpgnVFDQ6lxYuGxMwxnGyxST52BVVujr2hxM2Jiq6WM4z0SpI NvZ8iF+6v4TkLIMezEjFRr8Vhg9GZr+Qkb26J9/2HADKDqTWAfHqk1fLlBMw0C/BkqZ5 7aDtnJYxwax+YN91avhn92Z+G30FKXYYmtlA/3Pgk8b57dmMdsouKCImti3mSEbqlp8K BuqscCwQOK0qPbxTP8vloVEdHaPX+2YFj1bRct9iXQJBQFMxr394xHdQHngmWFKHMPJe loDulg6HWpsv2f+vo/SRfDta8usfhVmq1NL0GMBzaUVlnZM7WpNQA0z/O6aLkG7hT2Ia +MZQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:from:subject:mime-version :message-id:date:dkim-signature; bh=nvAJ73uOva6L67ScKM3nQf7DLT+6Xp7iUQAv2S4wZr0=; b=JiRWLkxTzuSumfoZTbC6R121OUGBZspDQCpUYiI1UZfUsHmoEEz+EmWraZW+hrFv+R Qku27GqOOn+MZidVGUfNAL/3cjQQ5Obr4WSfRYhYoyrYMKxfx8fc/TnHzQxwomboqYbb rQkunyhr2zp8DRVvRVNmTc6YzdekjLjs2fRPnOfP9RlyLGCPEi5rtIH/e7r1/ZjCxDBT neTcqFP9wkCbBLbzYSW8fpjAErlm3hSCOajoOoyCNvDF2fLshsCVQFTsrY7iyVNj0Qkj z0MzvNKh8JDCCIbmuIJnBshLBP6vmoMn3kafO6H6rSTO86xn9wELxp/QE0G+9Rqa4hbP fAEA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=XOjdqkXV; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c12si3313754edr.580.2020.05.21.12.19.33; Thu, 21 May 2020 12:19:56 -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; dkim=pass header.i=@google.com header.s=20161025 header.b=XOjdqkXV; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730344AbgEUTSM (ORCPT + 99 others); Thu, 21 May 2020 15:18:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43806 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730239AbgEUTSK (ORCPT ); Thu, 21 May 2020 15:18:10 -0400 Received: from mail-yb1-xb4a.google.com (mail-yb1-xb4a.google.com [IPv6:2607:f8b0:4864:20::b4a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 85195C061A0E for ; Thu, 21 May 2020 12:18:09 -0700 (PDT) Received: by mail-yb1-xb4a.google.com with SMTP id d7so6498587ybp.12 for ; Thu, 21 May 2020 12:18:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:message-id:mime-version:subject:from:to:cc; bh=nvAJ73uOva6L67ScKM3nQf7DLT+6Xp7iUQAv2S4wZr0=; b=XOjdqkXVdlfc+buczRZyVO5UqBw+OKSF1qBoNSX1Hn/h1nfCxlFHhGlhMfN2Yg162t 6XXR5MpetLwXTax4xL27XgKVFLkVFcw5g4c3/Y+H1zr3YsLa87kUDBslil9K9i/UzcXO IL88XHFVyfvlkBOXI6hX5nrKtmvJTeqf1Rv+cX+X/mIU4aiOeVKiidJdo2Egxo26QqSq 3TSNyw2D+G3F8aTo0vZ8bW4mQ0rbZY/ItbD8rHzBjPeOFw+PUQTlno1wh5yoCqUEkIDz eCyxPEMAlGsMJqKqCMo2aW9TETwK3wuWy2lZ8WWFi/ZYSfIr1UwWfsp+tGeivj9Hw0wl tOrw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:message-id:mime-version:subject:from:to:cc; bh=nvAJ73uOva6L67ScKM3nQf7DLT+6Xp7iUQAv2S4wZr0=; b=pCqEbkkSVBrV8ojFNHdQoxXq0Ju2XmHkBLq4P3t1zGpK7txJqoGa9fu4qwgVIL7EMf 4gp7HuE8sgyxh+eA+MhlnUASBaaGFxUhkfXnZfLYUb1KxjlIZUOAkp9a6DjDULM1+RvH Vo9dGwyuku0VA0QrWU25WycAvi5o19s2MpYZEuNDCCWeJYeWiOSXMNHsjpui0iVdLwh6 RlYPAGNhzIvlpLuiJlpCRHB+7Ij8BAJJB4m0qlAiPe/kVhlkZHL3KBJZggYBG8jDJGpE CFk1l/3pA9fECcpE76MihAeXu2q3hAvbroqeCH37e3X8lNOV4hHvu/TRpFcwYd5n00nf rlPQ== X-Gm-Message-State: AOAM530RaB6XPfiW1BB6kVWZDVbxw2pmMDqjBwe/bYIPxRTyCq1gh9aQ 4t7kiP62Hv62wQ1l7jbEftCFZeox74+Cp0s= X-Received: by 2002:a05:6902:728:: with SMTP id l8mr19177361ybt.127.1590088688764; Thu, 21 May 2020 12:18:08 -0700 (PDT) Date: Thu, 21 May 2020 12:17:57 -0700 Message-Id: <20200521191800.136035-1-saravanak@google.com> Mime-Version: 1.0 X-Mailer: git-send-email 2.27.0.rc0.183.gde8f92d652-goog Subject: [PATCH v3 0/3] driver core: Add device link related sysfs files From: Saravana Kannan To: Greg Kroah-Hartman , "Rafael J. Wysocki" Cc: Saravana Kannan , linux-kernel@vger.kernel.org, John Stultz , kernel-team@android.com Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org With fw_devlink and with sync_state() callback features, there's a lot of device/device link related information that's not available in sysfs. Exposing these details to user space can be very useful in understanding suspend/resume issues, runtime pm issues, probing issues, figuring out the modules that'd be needed for first stage init, etc. In fact, an earlier verion of this series was very helpful in debugging and validating the recent memory leak fix[1]. This series is based on driver-core-next and [1] cherry-picked on top of it. [1] - https://lore.kernel.org/lkml/20200519063000.128819-1-saravanak@google.com/ v1->v2: Patch 1/4 - New patch Patch 2/4 - Fixed the warnings I saw before that were related to incorrect sysfs removal code when a device link is deleted. - Fixed error handling in device_link_add() - Split up flags into more meaningful files. - Added status file. Patch 3/4 - Fixed error handling that Greg pointed out before. Patch 4/4 - New patch v2->v3: - Dropped patch 1/4 from v2 since it was already picked up. So numbering has shifted. Patch 1/3 - Added documentation Saravana Kannan (3): driver core: Expose device link details in sysfs driver core: Add state_synced sysfs file for devices that support it driver core: Add waiting_for_supplier sysfs file for devices Documentation/ABI/testing/sysfs-class-devlink | 126 ++++++++++ .../ABI/testing/sysfs-devices-consumer | 8 + .../ABI/testing/sysfs-devices-state_synced | 24 ++ .../ABI/testing/sysfs-devices-supplier | 8 + .../sysfs-devices-waiting_for_supplier | 17 ++ drivers/base/core.c | 237 +++++++++++++++++- drivers/base/dd.c | 22 ++ include/linux/device.h | 58 ++--- 8 files changed, 464 insertions(+), 36 deletions(-) create mode 100644 Documentation/ABI/testing/sysfs-class-devlink create mode 100644 Documentation/ABI/testing/sysfs-devices-consumer create mode 100644 Documentation/ABI/testing/sysfs-devices-state_synced create mode 100644 Documentation/ABI/testing/sysfs-devices-supplier create mode 100644 Documentation/ABI/testing/sysfs-devices-waiting_for_supplier -- 2.27.0.rc0.183.gde8f92d652-goog