lkml.org 
[lkml]   [2023]   [Jan]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH v1 1/6] i2c: hpe: Add GXP SoC I2C Controller
Date
> > + GFP_KERNEL);
> > + if (!drvdata)
> > + return -ENOMEM;
> > +
> > + platform_set_drvdata(pdev, drvdata);
> > + drvdata->dev = &pdev->dev;
> > + init_completion(&drvdata->completion);
> > +
> > + res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> > + drvdata->base = devm_ioremap_resource(&pdev->dev, res);

> It's one call, not two. Use the respective helper.

Greetings Krzysztof,

Thank you for the feedback. I am in the process of applying your recommended
changes but do have a question on this comment.

I can replace these two lines with:
drvdata->base = devm_platform_ioremap_resource(pdev, 0);

However, I still have a need for the resource "res" here to determine the physical
address of the device here:

> > + if (IS_ERR(drvdata->base))
> > + return PTR_ERR(drvdata->base);
> > +
> > + drvdata->engine = (res->start & 0xf00) >> 8;
> > + pr_info("%s: i2c engine%d\n", __func__, drvdata->engine);

Hence at some point I believe I will still need to call the "platform_get_resource"
function to accomplish this. Is this acceptable or perhaps you have another
suggestion?

One alternative I thought of was including a property in the device tree node
That specifies which i2c engine this is: hpe,gxp-engine = <1>.

Thank you,

-Nick Hawkins


\
 
 \ /
  Last update: 2023-03-26 23:33    [W:4.175 / U:0.004 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site