lkml.org 
[lkml]   [2023]   [Mar]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 2/4] cxl/pci: Find and register CXL PMU devices
On Fri, 03 Mar 2023, Jonathan Cameron wrote:

>+int devm_cxl_cpmu_add(struct device *parent, struct cxl_cpmu_regs *regs, int index)
>+{
>+ struct cxl_cpmu *cpmu;
>+ struct device *dev;
>+ int rc;
>+
>+ cpmu = kzalloc(sizeof(*cpmu), GFP_KERNEL);
>+ if (!cpmu)
>+ return -ENOMEM;
>+
>+ cpmu->base = regs->cpmu;
>+ dev = &cpmu->dev;
>+ device_initialize(dev);
>+ device_set_pm_not_required(dev);
>+ dev->parent = parent;
>+ dev->bus = &cxl_bus_type;
>+ dev->type = &cxl_cpmu_type;
>+ rc = ida_alloc(&cpmu_ida, GFP_KERNEL);
>+ if (rc < 0)
>+ goto err;

Probably better to do the ida_alloc after the cpmu allocation above, before
arming the dev.

\
 
 \ /
  Last update: 2023-03-27 00:46    [W:0.532 / U:0.040 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site