Messages in this thread | | | From | "Starke, Daniel" <> | Subject | RE: [PATCH 1/3] tty: n_gsm: add ioctl for DLC specific parameter configuration | Date | Tue, 28 Feb 2023 07:08:42 +0000 |
| |
> > +static void gsm_dlci_copy_config_values(struct gsm_dlci *dlci, struct gsm_dlci_config *dc) > > +{ > > + memset(dc, 0, sizeof(*dc)); > > + dc->channel = (u32)dlci->addr; > > + dc->adaption = (u32)dlci->adaption; > > + dc->mtu = (u32)dlci->mtu; > > + dc->priority = (u32)dlci->prio; > > + if (dlci->ftype == UIH) > > + dc->i = 1; > > + else > > + dc->i = 2; > > + dc->k = (u32)dlci->k; > > Why all those casts?
These fields in 'dlci' differ either in size and/or signedness from the values of the ioctl structure for historic reasons. That is why I perform explicit casts here.
> > + if ((int)dc->adaption != dlci->adaption) > > + need_restart = true; > > + if ((unsigned int)dc->mtu != dlci->mtu) > > + need_restart = true; > > + if ((u8)dc->i != dlci->ftype) > > + need_restart = true; > > + /* Requires care */ > > + if ((u8)dc->priority != (u32)dlci->prio) > > + need_restart = true; > > And here.
I will remove these.
> > + if (dlci->mtu) > > dc->mtu?
Right, my mistake. Will be corrected in the next version of this patch.
Best regards, Daniel Starke
| |