From: Thierry Reding <thierry.reding@gmail.com>
To: walter harms <wharms@bfs.de>
Cc: xorg-devel@lists.x.org, dri-devel@lists.freedesktop.org
Subject: Re: [PATCH libdrm v3 3/5] xf86drm: Add platform and host1x bus support
Date: Thu, 19 Jan 2017 11:25:51 +0100 [thread overview]
Message-ID: <20170119102551.GC30182@ulmo.ba.sec> (raw)
In-Reply-To: <587F8304.90105@bfs.de>
[-- Attachment #1.1: Type: text/plain, Size: 2398 bytes --]
Adding back dri-devel@lists.freedesktop.org
On Wed, Jan 18, 2017 at 04:00:20PM +0100, walter harms wrote:
> Am 18.01.2017 10:02, schrieb Thierry Reding:
[...]
> > diff --git a/xf86drm.c b/xf86drm.c
[...]
> > @@ -3187,11 +3199,55 @@ static int drmParsePciDeviceInfo(int maj, int min,
> > #endif
> > }
> >
> > +static void drmFreePlatformDevice(drmDevicePtr device)
> > +{
> > + if (device->deviceinfo.platform) {
>
> to save 2 indent level and improve readability :
>
> if (! device->deviceinfo.platform ||
> ! device->deviceinfo.platform->compatible)
> return;
>
> > + if (device->deviceinfo.platform->compatible) {
> > + char **compatible = device->deviceinfo.platform->compatible;
> > +
> > + while (*compatible) {
> > + free(*compatible);
> > + compatible++;
> > + }
> > +
> > + free(device->deviceinfo.platform->compatible);
> > + }
> > + }
I chose the above style because I thought readability wasn't impacted
and it has the advantage of making the code more easily extensible
should we ever need to add code to it.
> > +static int drmProcessHost1xDevice(drmDevicePtr *device,
> > + const char *node, int node_type,
> > + int maj, int min, bool fetch_deviceinfo,
> > + uint32_t flags)
> > +{
> > + drmDevicePtr dev;
> > + char *ptr;
> > + int ret;
> > +
> > + dev = drmDeviceAlloc(node_type, node, sizeof(drmHost1xBusInfo),
> > + sizeof(drmHost1xDeviceInfo), &ptr);
> > + if (!dev)
> > + return -ENOMEM;
> > +
> > + dev->bustype = DRM_BUS_HOST1X;
> > +
> > + dev->businfo.host1x = (drmHost1xBusInfoPtr)ptr;
> > +
> > + ret = drmParseHost1xBusInfo(maj, min, dev->businfo.host1x);
> > + if (ret < 0)
> > + goto free_device;
> > +
> > + if (fetch_deviceinfo) {
> > + ptr += sizeof(drmHost1xBusInfo);
> > + dev->deviceinfo.host1x = (drmHost1xDeviceInfoPtr)ptr;
> > +
> > + ret = drmParseHost1xDeviceInfo(maj, min, dev->deviceinfo.host1x);
> > + if (ret < 0)
> > + goto free_device;
> > + }
> > +
> > + *device = dev;
> > +
>
> do you assume that fetch_deviceinfo may change dev ?
No, why?
Thierry
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
[-- Attachment #2: Type: text/plain, Size: 160 bytes --]
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
next prev parent reply other threads:[~2017-01-19 10:25 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-18 9:02 [PATCH libdrm v3 0/5] xf86drm: Add USB, platform and host1x bus support Thierry Reding
2017-01-18 9:02 ` [PATCH libdrm v3 1/5] xf86drm: Factor out drmDeviceAlloc() Thierry Reding
[not found] ` <20170118090209.13819-1-thierry.reding-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-01-18 9:02 ` [PATCH libdrm v3 2/5] xf86drm: Add USB support Thierry Reding
[not found] ` <587F4FB3.2070006@bfs.de>
2017-01-19 10:20 ` Thierry Reding
[not found] ` <20170119102038.GB30182-EkSeR96xj6Pcmrwk2tT4+A@public.gmane.org>
2017-01-21 17:44 ` walter harms
2017-01-18 9:02 ` [PATCH libdrm v3 3/5] xf86drm: Add platform and host1x bus support Thierry Reding
[not found] ` <587F8304.90105@bfs.de>
2017-01-19 10:25 ` Thierry Reding [this message]
[not found] ` <20170118090209.13819-4-thierry.reding-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-01-20 14:03 ` Emil Velikov
2017-01-18 9:02 ` [PATCH libdrm v3 4/5] tests/drmdevice: Add USB, platform and host1x support Thierry Reding
2017-01-18 9:02 ` [PATCH libdrm v3 5/5] xf86drm: Reuse sysfs_uevent_get() Thierry Reding
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170119102551.GC30182@ulmo.ba.sec \
--to=thierry.reding@gmail.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=wharms@bfs.de \
--cc=xorg-devel@lists.x.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.