Re: [PATCH v4 05/15] mei: pxp: add command streamer API to the PXP driver

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> 
> On Thu, Sep 08, 2022 at 05:16:02PM -0700, Daniele Ceraolo Spurio wrote:
> > +static ssize_t mei_pxp_gsc_command(struct device *dev, u8 client_id,
> u32 fence_id,
> > +				   struct scatterlist *sg_in, size_t total_in_len,
> > +				   struct scatterlist *sg_out)
> > +{
> > +	struct mei_cl_device *cldev;
> > +
> > +	if (!dev || !sg_in || !sg_out)
> > +		return -EINVAL;
> 
> How can these ever be NULL?  Doesn't the core control this, so why would
> that happen?
This is any interface function between modules, I think it is not healthy to take assumptions here about how caller
behaves, this is not an inner functions. This is important even for catching programmatical mistakes. 
> 
> Don't check for things that can never happen.
> 
> > +
> > +	cldev = to_mei_cl_device(dev);
> > +
> > +	return mei_cldev_send_gsc_command(cldev, client_id, fence_id,
> sg_in,
> > +total_in_len, sg_out); }
> > +
> >  static const struct i915_pxp_component_ops mei_pxp_ops = {
> >  	.owner = THIS_MODULE,
> >  	.send = mei_pxp_send_message,
> >  	.recv = mei_pxp_receive_message,
> > +	.gsc_command = mei_pxp_gsc_command,
> >  };
> >
> >  static int mei_component_master_bind(struct device *dev) diff --git
> > a/include/drm/i915_pxp_tee_interface.h
> > b/include/drm/i915_pxp_tee_interface.h
> > index af593ec64469..a702b6ec17f7 100644
> > --- a/include/drm/i915_pxp_tee_interface.h
> > +++ b/include/drm/i915_pxp_tee_interface.h
> > @@ -8,6 +8,7 @@
> >
> >  #include <linux/mutex.h>
> >  #include <linux/device.h>
> > +struct scatterlist;
> >
> >  /**
> >   * struct i915_pxp_component_ops - ops for PXP services.
> > @@ -23,6 +24,10 @@ struct i915_pxp_component_ops {
> >
> >  	int (*send)(struct device *dev, const void *message, size_t size);
> >  	int (*recv)(struct device *dev, void *buffer, size_t size);
> > +	ssize_t (*gsc_command)(struct device *dev, u8 client_id, u32
> fence_id,
> > +			       struct scatterlist *sg_in, size_t total_in_len,
> > +			       struct scatterlist *sg_out);
> 
> No documentation for this new callback?
> 
> The build should give you are warning :(
Will fix.

Thanks
Tomas






[Index of Archives]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux