Re: [PATCH v3 02/30] drivers: hv: dxgkrnl: Driver initialization and loading

From: Greg KH
Date: Thu Mar 03 2022 - 08:11:05 EST


On Wed, Mar 02, 2022 at 03:27:56PM -0800, Iouri Tarassov wrote:
>
> On 3/1/2022 12:45 PM, Greg KH wrote:
> > On Tue, Mar 01, 2022 at 11:45:49AM -0800, Iouri Tarassov wrote:
> > > - Create skeleton and add basic functionality for the
> > > hyper-v compute device driver (dxgkrnl).
> > >
> > > +
> > > +#undef pr_fmt
> > > +#define pr_fmt(fmt) "dxgk: " fmt
> >
> > Use the dev_*() print functions, you are a driver, and you always have a
> > pointer to a struct device. There's no need to ever call pr_*().
> >
>
> There is no struct device during module initialization until the
> /dev/dxg device is created.

Then you should not have anything to print out.

> Is it ok to use pr_* functions in this case?

Nope.

> Should dev_*(NULL,...) be used?

No, not at all, never!

> I see other drivers use the pr_* functions in this case (mips.c as an
> example).

There are lots of bad examples in the kernel tree, let's make your code
a good one.

thanks,

greg k-h