Re: [PATCH] serial: 8250: Optimize port function assignment with generic macro

From: Pei Xiao
Date: Thu Mar 06 2025 - 21:13:41 EST



在 2025/3/6 15:05, Greg KH 写道:
> On Thu, Mar 06, 2025 at 11:00:32AM +0800, xiaopeitux@xxxxxxxxxxx wrote:
>> From: xiaopei01 <xiaopei01@xxxxxxxxxx>
> Sorry, as per the documentation we need a name, not just an email alias.

ok,perhaps I changed a new computer to send patch caused it. 

I will modify in next time!

>> Refactor repetitive conditional function pointer assignments using a
>> generic macro ASSIGN_IF_EXIST. This consolidates 15+ conditional
>> checks into a consistent pattern while maintaining type safety.
> But why? Macros are a pain and hide what is happening here. Do you
> think this makes the code more maintainable over time? Does it fix any
> existing bugs?

sorry for make some noise,I know you're a very busy person. 

Sorry for disturbing you!

No,it don't fix any bugs.Indeed, it's less readable than the previous code. 

Initially, I thought there were too many repetitive lines, 

and the code length could be reduced.


thanks!

Pei Xiao

> thanks,
>
> greg k-h