lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <2023112232-crawfish-twig-0937@gregkh>
Date:   Wed, 22 Nov 2023 08:53:56 +0000
From:   Greg KH <gregkh@...uxfoundation.org>
To:     Abhijit Gangurde <abhijit.gangurde@....com>
Cc:     linux-kernel@...r.kernel.org, Nipun.Gupta@....com,
        puneet.gupta@....com, nikhil.agarwal@....com, michal.simek@....com,
        git@....com
Subject: Re: [PATCH 2/2] cdx: Create resource debugfs file for cdx device

On Wed, Nov 22, 2023 at 01:33:00PM +0530, Abhijit Gangurde wrote:
> resource debugfs file contains host addresses of CDX device resources.
> Each line of the resource file describe a region with start, end and
> flag fields.
> 
> Signed-off-by: Abhijit Gangurde <abhijit.gangurde@....com>
> ---
>  drivers/cdx/cdx.c           | 42 ++++++++++++++++++++++++++++++++++++-
>  include/linux/cdx/cdx_bus.h |  2 ++
>  2 files changed, 43 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/cdx/cdx.c b/drivers/cdx/cdx.c
> index 4edf64f9e98d..e01376272ed3 100644
> --- a/drivers/cdx/cdx.c
> +++ b/drivers/cdx/cdx.c
> @@ -65,6 +65,7 @@
>  #include <linux/cdx/cdx_bus.h>
>  #include <linux/iommu.h>
>  #include <linux/dma-map-ops.h>
> +#include <linux/debugfs.h>
>  #include "cdx.h"
>  
>  /* Default DMA mask for devices on a CDX bus */
> @@ -75,6 +76,8 @@
>  static DEFINE_IDA(cdx_controller_ida);
>  /* Lock to protect controller ops */
>  static DEFINE_MUTEX(cdx_controller_lock);
> +/* Debugfs dir for cdx bus */
> +static struct dentry *cdx_debugfs_dir;
>  
>  static char *compat_node_name = "xlnx,versal-net-cdx";
>  
> @@ -149,6 +152,7 @@ static int cdx_unregister_device(struct device *dev,
>  			cdx->ops->bus_disable(cdx, cdx_dev->bus_num);
>  	} else {
>  		cdx_destroy_res_attr(cdx_dev, MAX_CDX_DEV_RESOURCES);
> +		debugfs_remove_recursive(cdx_dev->debugfs_dir);
>  		kfree(cdx_dev->driver_override);
>  		cdx_dev->driver_override = NULL;
>  	}
> @@ -552,6 +556,34 @@ static const struct attribute_group *cdx_dev_groups[] = {
>  	NULL,
>  };
>  
> +static int cdx_debug_resource_show(struct seq_file *s, void *data)
> +{
> +	struct cdx_device *cdx_dev = s->private;
> +	int i;
> +
> +	for (i = 0; i < MAX_CDX_DEV_RESOURCES; i++) {
> +		struct resource *res =  &cdx_dev->res[i];
> +
> +		seq_printf(s, "0x%016llx 0x%016llx 0x%016llx\n",
> +			   (unsigned long long)res->start,
> +			   (unsigned long long)res->end,
> +			   (unsigned long long)res->flags);

Why not just use %pR or %pr instead of creating your own style of
format?

thanks,

greg k-h

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ