[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZA9wUe33pMkhMu0e@hoboy.vegasvil.org>
Date: Mon, 13 Mar 2023 11:49:53 -0700
From: Richard Cochran <richardcochran@...il.com>
To: Tianfei Zhang <tianfei.zhang@...el.com>
Cc: netdev@...r.kernel.org, linux-fpga@...r.kernel.org,
ilpo.jarvinen@...ux.intel.com, andriy.shevchenko@...ux.intel.com,
russell.h.weight@...el.com, matthew.gerlach@...ux.intel.com,
pierre-louis.bossart@...ux.intel.com, vinicius.gomes@...el.com,
Raghavendra Khadatare <raghavendrax.anand.khadatare@...el.com>
Subject: Re: [PATCH v1] ptp: add ToD device driver for Intel FPGA cards
On Sun, Mar 12, 2023 at 11:02:39PM -0400, Tianfei Zhang wrote:
> +static int dfl_tod_probe(struct dfl_device *ddev)
> +{
> + struct device *dev = &ddev->dev;
> + struct dfl_tod *dt;
> +
> + dt = devm_kzalloc(dev, sizeof(*dt), GFP_KERNEL);
> + if (!dt)
> + return -ENOMEM;
> +
> + dt->tod_ctrl = devm_ioremap_resource(dev, &ddev->mmio_res);
> + if (IS_ERR(dt->tod_ctrl))
> + return PTR_ERR(dt->tod_ctrl);
> +
> + dt->dev = dev;
> + spin_lock_init(&dt->tod_lock);
> + dev_set_drvdata(dev, dt);
> +
> + dt->ptp_clock_ops = dfl_tod_clock_ops;
> +
> + dt->ptp_clock = ptp_clock_register(&dt->ptp_clock_ops, dev);
> + if (IS_ERR(dt->ptp_clock))
> + return dev_err_probe(dt->dev, PTR_ERR(dt->ptp_clock),
> + "Unable to register PTP clock\n");
Need to handle NULL as well...
/**
* ptp_clock_register() - register a PTP hardware clock driver
*
* @info: Structure describing the new clock.
* @parent: Pointer to the parent device of the new clock.
*
* Returns a valid pointer on success or PTR_ERR on failure. If PHC
* support is missing at the configuration level, this function
* returns NULL, and drivers are expected to gracefully handle that
* case separately.
*/
Thanks,
Richard
Powered by blists - more mailing lists