Is this a valid Substitution Shortcut for differential equation?

Given $\frac{y}{x}\cos\frac{y}{x}dx-(\frac{x}{y}\sin\frac{y}{x}+\cos\frac{y}{x})dy = 0$

This is a homogeneous differential equation.

Is it valid to substitute $u=\frac{y}{x}$ and $dy=udx+xdu$ into the equation?

If so, after substitution, simplification, and separation of variables I got the following equation $-\log|x|=\log|u|+\int\frac{1}{u}\cot{u}du$

Singling out $\int\frac{1}{u}\cot{u}du$ to be integrated through integration by parts technique I got $\int\frac{1}{u}\cot{u}du = \cot{u}\log|u|+\int \log|u|\csc^2{u}du$

So, is my initial substitution valid? If so, I'm not sure what substitutions to use next in integrating $\int \log|u|\csc^2{u}du$..

Let $u=\frac yx$. Then, $\frac{dy}{dx}=u+x\frac{du}{dx}$ $$\frac{y}{x}\cos\frac{y}{x}dx-\left(\frac{x}{y}\sin\frac{y}{x}+\cos\frac{y}{x}\right)dy = 0$$ $$\frac{dy}{dx}=\frac{\frac{y}{x}\cos\frac{y}{x}}{\frac{x}{y}\sin\frac{y}{x}+\cos\frac{y}{x}}$$ $$u+x\frac{du}{dx}=\frac{u\cos u}{\frac{1}{u}\sin u+\cos u}$$ $$u+x\frac{du}{dx}=\frac{u^2\cos u}{\sin u+u\cos u}$$ $$x\frac{du}{dx}=\frac{u^2\cos u-u\sin u-u^2\cos u}{\sin u+u\cos u}$$ $$x\frac{du}{dx}=\frac{-u\sin u}{\sin u+u\cos u}$$ $$\int\frac{(\sin u+u\cos u)du}{u\sin u}=\int\frac{-dx}{x}$$ $$\int\left(\frac1u+\cot u\right)du=\int\frac{-dx}{x}$$ $$\ln|u|+\ln|\sin u|=-\ln|x|+c$$
First write $$\frac{dy}{dx}=\frac{\frac{y}{x}\cos {\frac{y}{x}}}{\frac{x}{y}\sin\frac{y}{x}+\cos\frac{y}{x}}$$ Then put $y=vx$ to get, $\frac {dy}{dx}= v+ x\frac{dv}{dx}$ $$\implies x\frac{dv}{dx}=\frac{v^2 \cos v}{\sin v+v\cos v}-v$$ $$\implies \int \frac{(\sin v+v \cos v) dv}{v\sin v}= -\int \frac{dx}{x}$$ $$\implies \ln |v| +\ln |\sin v|= -\ln x+C$$ Now simplify and substitute $v=\frac{y}{x}$, to get the answer.