Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1361309
| From | Thomas Gleixner <tglx@linutronix.de> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [Patch V2 1/4] iommu/vt-d: replace *hdr with hdr[0] in struct dmar_drhd_unit |
| Date | 2016-03-20 16:50 +0100 |
| Message-ID | <reNM6-pp-17@gated-at.bofh.it> (permalink) |
| References | <reM3D-7Fe-3@gated-at.bofh.it> <reM3E-7Fe-17@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Sun, 20 Mar 2016, Wei Yang wrote: > hdr in struct dmar_drhd_unit is used to point the DMAR hardware unit copied > at the end of struct dmar_drhd_unit. One zero-sized array may be more > elegant for this purpose. You forget to tell why. > This patch replace *hdr with hdr[0] in struct dmar_drhd_unit. > > Besides this, this patch includes other two changes: > 1. remove unnecessary type cast in dmar_table_detect() Again. Why is it not necessary? > 2. type cast from acpi_dmar_header to acpi_dmar_hardware_unit directly Don't even think about doing that. container_of() is there for a reason. Your change works today, because the embedded structure is the first one in the containing structure. If the containing structure gets reordered later, the whole thing will explode in hard to debug ways. Even if such a reordering is unlikely in that ACPI case, we just don't do that. It's bad and sloppy coding style. The generated code is the same. Thanks, tglx
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[Patch V2 0/4] Code refine for Intel IOMMU Wei Yang <richard.weiyang@gmail.com> - 2016-03-20 15:00 +0100
[Patch V2 2/4] iommu/vt-d: use zero-sized array in DMAR related ACPI structures Wei Yang <richard.weiyang@gmail.com> - 2016-03-20 15:00 +0100
[Patch V2 1/4] iommu/vt-d: replace *hdr with hdr[0] in struct dmar_drhd_unit Wei Yang <richard.weiyang@gmail.com> - 2016-03-20 15:00 +0100
Re: [Patch V2 1/4] iommu/vt-d: replace *hdr with hdr[0] in struct dmar_drhd_unit Thomas Gleixner <tglx@linutronix.de> - 2016-03-20 16:50 +0100
Re: [Patch V2 1/4] iommu/vt-d: replace *hdr with hdr[0] in struct dmar_drhd_unit Wei Yang <richard.weiyang@gmail.com> - 2016-03-21 15:50 +0100
Re: [Patch V2 1/4] iommu/vt-d: replace *hdr with hdr[0] in struct dmar_drhd_unit Thomas Gleixner <tglx@linutronix.de> - 2016-03-21 18:00 +0100
Re: [Patch V2 1/4] iommu/vt-d: replace *hdr with hdr[0] in struct dmar_drhd_unit Wei Yang <richard.weiyang@gmail.com> - 2016-03-21 23:40 +0100
[Patch V2 4/4] iommu/vt-d: refine dmar_acpi_dev_scope_init() with dmar_walk_dmar_table() Wei Yang <richard.weiyang@gmail.com> - 2016-03-20 15:00 +0100
csiph-web