Skip to contentSkip to conversation

Coding style

DISCUSSION Goel, Sameer 2 participants 4 messages Apr 27, 2017

lore
Share & tools
lore
#0 lore raw

I am trying to port a Linux driver to Xen. After making the changes it seems that there are enough changes to say that this driver is different enough as compared to the original file. But it still has code from the original author that is used as is.

Based on the CODING_STYLE document I was following the Linux coding style for this file. Since, the file looks a lot different, I am wondering if I should convert this to Xen coding style?

Thanks,
Sameer

Signature · 6 lines
 Qualcomm Datacenter Technologies as an affiliate of Qualcomm Technologies, Inc. Qualcomm Technologies, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
#1 lore raw

Hello,

Quoted 9 lines · Sameer,

I am trying to port a Linux driver to Xen. After making the changes it seems that there are enough changes to say that this driver is different enough as compared to the original file. But it still has code from the original author that is used as is.

Based on the CODING_STYLE document I was following the Linux coding style for this file. Since, the file looks a lot different, I am wondering if I should convert this to Xen coding style?

My concern is if we diverge too much from Linux we will increase the maintainance cost.

It will be very difficult to backport patch and we would not benefit from Linux testing.

I did this mistake with SMMU v2 and I had to rewrite everything 6 months later.

So before giving any answer here, I'd like to understand what changes you had to make.

Cheers,

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#2 lore raw

The changes at this point are similar in spirit to SMMUv2, with additions for ACPI parsing. I have not #def'd the platform_get functions or the dma allocation functions, prints et al. I have deleted out unneeded functions instead of wrapping them in if 0 based on some internal review.

Your response helps. I can try to keep the code as similar to the upstream driver as possible. So, I will follow the origin file coding standard. Thanks,
Sameer

Quoted 25 lines · Julien Grall

Hello,

On Thu, 27 Apr 2017, 20:12 Goel, Sameer, <[email protected] <mailto:[email protected]>> wrote:

I am trying to port a Linux driver to Xen. After making the changes it seems that there are enough changes to say that this driver is different enough as compared to the original file. But it still has code from the original author that is used as is.

Based on the CODING_STYLE document I was following the Linux coding style for this file. Since, the file looks a lot different, I am wondering if I should convert this to Xen coding style?

My concern is if we diverge too much from Linux we will increase the maintainance cost.

It will be very difficult to backport patch and we would not benefit from Linux testing.

I did this mistake with SMMU v2 and I had to rewrite everything 6 months later.

So before giving any answer here, I'd like to understand what changes you had to make.

Cheers,

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

Signature · 6 lines
 Qualcomm Datacenter Technologies as an affiliate of Qualcomm Technologies, Inc. Qualcomm Technologies, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
#3 lore raw

Hello,

Please avoid top-posting.

Quoted 5 lines · Sameer,

The changes at this point are similar in spirit to SMMUv2, with additions for ACPI parsing. I have not #def'd the platform_get functions or the dma allocation functions, prints et al. I have deleted out unneeded functions instead of wrapping them in if 0 based on some internal review.

I would not recommend to drop them. We decided to use #if 0 on the SMMUv2 driver because it makes easier to port patches.

Similarly any Xen changes in Linux code have a comment on top.

Lastly we first introduced a patch with a verbatim copy of Linux drivers. Then add Xen changes on top.

Cheers,

Quoted 42 lines

Your response helps. I can try to keep the code as similar to the upstream driver as possible. So, I will follow the origin file coding standard. Thanks,
Sameer

Quoted 3 lines · Julien Grall

Hello,

On Thu, 27 Apr 2017, 20:12 Goel, Sameer, <[email protected] <mailto:

Quoted 2 lines · [email protected]>> wrote:

I am trying to port a Linux driver to Xen. After making the changes

it seems that there are enough changes to say that this driver is different enough as compared to the original file. But it still has code from the original author that is used as is.

Quoted 2 lines

Based on the CODING_STYLE document I was following the Linux coding

style for this file. Since, the file looks a lot different, I am wondering if I should convert this to Xen coding style?

Quoted 3 lines

My concern is if we diverge too much from Linux we will increase the

maintainance cost.

Quoted 2 lines

It will be very difficult to backport patch and we would not benefit

from Linux testing.

Quoted 2 lines

I did this mistake with SMMU v2 and I had to rewrite everything 6 months

later.

Quoted 2 lines

So before giving any answer here, I'd like to understand what changes

you had to make.

Quoted 9 lines

Cheers,

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

Quoted 5 lines

--
Qualcomm Datacenter Technologies as an affiliate of Qualcomm
Technologies, Inc. Qualcomm Technologies, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel