The LF CoC is quite explicit: "Harassment will not be tolerated in any form, including but not limited to harassment based on gender, gender identity and expression, sexual orientation, disability, physical appearance, body size, race, age, religion or any other status protected by laws in which the conference or program is being held."
Given Mr. Trump's political actions especially against members of the LGBT community, disabled people (e.g. him mocking a reporter) or women ("grab them by the pussy"), it is crystal clear that associating oneself with Mr. Trump by wearing a MAGA hat is at least accepting those values and actions, and that this is open harassment towards people affected by Mr. Trump's politics.
Additionally, two paragraphs from the CoC also are a justification of the removal:
> All event participants are expected to behave in accordance with professional standards, with both the Linux Foundation Code of Conduct as well as their respective employer’s policies governing appropriate workplace behavior, and applicable laws
While wearing a MAGA hat is not illegal in itself, it is a violation of any kind of professional conduct.
> If a participant engages in harassing behavior, the conference organizers may take any action they deem appropriate, ranging from issuance of a warning to the offending individual to expulsion from the conference with no refund
And exactly this was the consequence. The troll knew what was coming for him, and I don't shed a tear.